Fork me on GitHub
#untangled
<
2016-04-04
>
vmarcinko04:04:01

@tony.kay: Thanx, nice to hear other people have the same problem. BTW, what you mean by environment bug? You mean some bad combination of Cursive, figwheel etc?

tony.kay15:04:45

@vmarcinko: Not sure. If I had a better idea I'd report it

ethangracer15:04:17

can anyone else confirm that the master branch is not loading the client for todomvc? when I start both the server and client repls, I can run the test build, and the server is auto-reloading (fancy! thanks @currentoor), the client just doesn’t seem to want to show up on localhost:3000

currentoor16:04:21

Why is it trying to load the min file? This dev we're talking about right?

tony.kay16:04:56

index is now production build

tony.kay16:04:01

@ethangracer: ^^^^

tony.kay16:04:27

is that in the instructions?

ethangracer16:04:53

ah, looks like that did get updated

ethangracer16:04:14

yes it is in the instructions, i just didn’t catch it

currentoor18:04:07

How do the untangled people feel about sablono? https://github.com/r0man/sablono

tony.kay18:04:27

like you can use it if you want

currentoor18:04:56

I wrote a macro that uses it to give a more concise syntax for defui.

currentoor18:04:15

Any chance you'd want to add that to untangled-client?

currentoor18:04:23

I won't be hurt if you say no.

currentoor18:04:49

We've gotten a lot of utility out of it so just thought I'd offer to add it here.

tony.kay18:04:28

Ah, as in it uses sablano and also makes the factory?

tony.kay18:04:57

I don't really want sablano to be a required dep for UC

tony.kay18:04:15

I'd be open to an untangled-sablano library

tony.kay18:04:40

if there is enough utility to add to such a thing simple_smile

currentoor18:04:25

So untangled-sablano could have the above macro?

tony.kay18:04:39

right, and whatever else you think would be nice to have

tony.kay18:04:45

for that concern

tony.kay18:04:03

you could own that, and we could ref your library from docs

currentoor18:04:22

that could work

adambros18:04:50

also if/when you take a look, defui+ was a personal experiment

adambros18:04:27

also I’m one of the few using vim & nrepl if anyone wants help on that

adambros18:04:44

@mahinshaw was a major help, but he is using spacemacs

mahinshaw18:04:46

I’m happy to help anyone who wants to get figwheel running on emacs. There are also some great docs on the figwheel wiki:

vmarcinko18:04:28

@currentoor: this defcomponent macro looks awesome!

currentoor19:04:43

@vmarcinko: thanks!

currentoor19:04:07

@adambros: do you have an example use of your wrapper?

adambros19:04:34

ive had to switch tasks so all i have is the spec file its not very easy to read so here’s a snippet:

currentoor19:04:33

Hmm cool we've done some similar things!

currentoor19:04:48

the factory function trick specifically

adambros19:04:01

defui+ was inspired by defscreen from https://github.com/oakes/play-clj

adambros19:04:21

and i was going to tinker more with the look but got distracted by other tasks

adambros19:04:43

the main focus of these defui's is to wrap the render method and have some devtools attached

currentoor20:04:20

I see, the main focus for me was making it less verbose and making the intent as clear as possible.

adambros20:04:39

defui+ was that for me 😄

adambros20:04:22

the idea for the devtools was to have a way to see what components are on screen, click to go to the source file, and even get their query onto a database overlay

adambros20:04:46

haha nice i see you prepended ui as well

currentoor20:04:20

yeah had conflicting symbols when i would destructure the result of a query

adambros20:04:59

ah yes, that was what started our investigation of how to name factory functions

adambros20:04:11

i had half jokingly suggested <comp>

adambros20:04:12

how’s untangled so far?

currentoor20:04:36

i'm gonna do a code walk through with my manager later and if he gives the go ahead we'll use it for our product

adambros20:04:45

well good luck

adambros20:04:37

just after tony told us he would open source, i joked that I “suddenly had the urge to clean up my code"

adambros20:04:47

still feel that way 😅

currentoor20:04:00

that's good, shame + pride is one of the best motivators

currentoor20:04:15

not that there's anything shameful here!

adambros20:04:31

most of my contributions are in untangled-spec, which was a hairball both internally and in how to use it

adambros20:04:40

still feel shivers thinking about it

adambros20:04:33

and i keep using it in every task, and wanting to tweak everything… i have to stop myself from switching and just writing down what i want to fix for later

currentoor20:04:17

yeah i know what you mean

tomjack20:04:24

I am also interested in this kind of "dev-time component middleware" (if you will) question

tomjack20:04:31

e.g. a highlight on rerender animation would be cool

tomjack20:04:41

I was thinking of just copying defui with a custom reshape map

tomjack21:04:50

presumably untangled won't depend on react-motion, so how could I add my highlight animation? not reinventing mixins is on my mind simple_smile

adambros21:04:34

not sure what that is other than a react addon...

adambros21:04:46

where are you trying to put that? (untangled or your app?)

tomjack21:04:23

well if the highlight-on-rerender goes into untangled, then my question (extensibility) goes away

adambros21:04:19

i think @tony.kay might be your best bet on that, but id be interested in that functionality in a defui wrapper

currentoor21:04:05

Any suggestions for running migrations on an in memory test db manually? I'm using core.test and I wanted to run them on the setup part. Like so

tomjack21:04:12

to be clear I don't plan to use untangled soon (learning om.next by itself first before I look more closely at it) -- but interested in the general question of defui wrappers or other solutions

tomjack21:04:57

I guess for 'extensibility' one just creates a new defui wrapper which wraps the next wrapper down simple_smile

adambros21:04:07

@currentoor: i think https://github.com/untangled-web/untangled-datomic/blob/master/src/untangled/datomic/schema.clj#L224 is what we’re using internally to run the migration/schema

adambros21:04:26

(io.rkn.conformity/ensure-conforms dbconnection migration)

adambros21:04:41

i’d imagine that’s what you’d want

tomjack21:04:42

I'm wondering about expressing the various dev-time middleware as separate components which take children, then just having dev-time factories wrap their results in those components

tomjack21:04:50

is it bad somehow to have extra dev-time components in the tree?

tomjack21:04:32

I guess for stuff like *cljs-file* we do need some more magic

adambros21:04:41

if you can elide the dev-time during production, i dont see the issue if you are careful about being a transparent wrapper

adambros21:04:18

im planning on doing that by using config

adambros21:04:34

or a System/getenv

tomjack21:04:49

guess what I'm wondering is how to create transparent wrappers. I'll experiment..

adambros21:04:36

id think a defn or a defui with only a render method would do

adambros21:04:05

but i think you need to pass it the right this or props

currentoor21:04:07

@adambros: thanks I'll check it out!

tony.kay21:04:38

@tomjack: Dev time concerns are of interest to us, as @adambros said. Highlight on rerender as a dev time option would be nice...as would click to jump to source, db panel, etc. We'll want to define the set we're looking for (feature-wise) and just start chipping away.

tony.kay21:04:06

I also encourage ppl to think about their real desired outcome, not just a suggested implementation. E.g. highlight on re-render is presumably to debug things not getting re-rendered...might be better ways of debugging that.

tomjack21:04:56

I was thinking of knowing when too much is getting rerendered

tomjack21:04:53

but my real interest is in the general problem -- a handy defui dev wrapper which does a fixed set of things would only be moderately interesting to me

tony.kay21:04:41

Well, more of a general Om topic then....what, exactly, are you looking for?

tony.kay21:04:58

transparent wrapper of what?

tony.kay21:04:10

render? What's wrong with a function

tony.kay21:04:20

lifecycle? Delegation comes to mind

tony.kay21:04:51

Syntactic sugar? Cljs macros

tomjack21:04:33

yeah, it's a general om problem. just happened to see a related non-solution float by here simple_smile

tomjack21:04:37

well, it's not actually clear that untangled.client.ui/defui is not a solution

tomjack21:04:01

I can just copy it into my project and add whatever stuff I want

tony.kay21:04:09

Right...custom macro.

currentoor22:04:48

Hi, I'm still having trouble getting the db setup for a test working. I'm trying this, am I even on the right track

currentoor22:04:32

Or is it not a good idea to use build-database in my test setup?

tony.kay22:04:57

build-database is a component....

tony.kay22:04:12

let me think....I'm on a Java thing right now...switching gears

tony.kay22:04:34

@ethangracer: You're working on tests, right? Remind me what we're doing for database setup in integration tests

tony.kay22:04:56

oh, right...`with-db-fixture`, right?

ethangracer22:04:59

@tony.kay @currentoor : to write tests against the database i’ve been using untangled.datomic.test-helpers/with-db-fixture)

ethangracer22:04:18

now I think @currentoor is looking to test migrations

ethangracer22:04:30

not sure if with-db-fixture is the place to do that

tony.kay22:04:49

Um...testing migrations isn't an automated thing so much as proven by the fact that the rest of your integration tests pass

tony.kay22:04:59

testing behaviors, not facts

tony.kay22:04:07

@currentoor: ^^^^

tony.kay22:04:38

No one should give a rats ass if your migrations fact-check...given that if the real behaviors don't work, then you're SOL anyway

tony.kay22:04:03

So, do real behavioral integration tests if you want to know your db is correct.

tony.kay22:04:18

schema is right only when the app works simple_smile

currentoor22:04:56

Oh I don't want to test migrations, I just wanted to run my tests on a migrated database

tony.kay22:04:05

Yeah....`with-db-fixture`

tony.kay22:04:16

that sets up a db, runs migrations, gives you connection

tony.kay22:04:18

as a wrapper

tony.kay22:04:29

like a let block

ethangracer22:04:43

with-db-fixture is a beautiful thing

ethangracer22:04:56

let me know if you’d like some sample code

tony.kay22:04:03

we also have with-system, I believe

currentoor22:04:03

awesome! yes please, @ethangracer

tony.kay22:04:30

sorry..need more docs on this stuff simple_smile It is a pretty complete set of tools 😉

currentoor22:04:15

lol no worries, takes time

ethangracer22:04:15

@currentoor: give me a few to pull one together

currentoor22:04:32

thanks a million!

tony.kay22:04:32

@ethangracer: I'm ok with you showing him a production test

ethangracer22:04:51

planning on it, just want to clean up some variable names for context

tony.kay22:04:07

@currentoor: We also have protocol testing, which is for writing tests that ensure the complete round-trip is correct

currentoor22:04:33

@tony.kay: yeah I started reading your writeup about that, fancy stuff.

tony.kay22:04:04

that was the initial draft of the idea...it is implemented now

tony.kay22:04:38

it isn't exactly like the doc, but it is there

ethangracer22:04:22

I included a helper function, db-fixture-defs which helps with testing

ethangracer22:04:46

essentially, you pass a symbol name that becomes a database component — that component is seeded using the migrations in the directory specified by the string after :migrations, and is seeded using the :seed-fn, which for us uses link-and-load-seed-data

tony.kay22:04:51

@currentoor: Have you seen the seeding tempid support?

currentoor22:04:03

from the todo-mvc app?

tony.kay22:04:11

no...in our testing code

tony.kay22:04:40

In the code he just shared: :

tony.kay22:04:55

is a placeholder for a datomic ID...you get back a map from those to the real ids after seeding

tony.kay22:04:24

his helper gives you back a get-id function

tony.kay22:04:42

(get-id :) would return the real ID it got assigned on seeding

tony.kay22:04:00

Makes it trivial to write db tests

tony.kay22:04:07

with arbitrary seeding

currentoor22:04:10

hmm, thanks i'll look into that later today

ethangracer22:04:50

i just double checked, I don’t have an example that doesn’t make extensive use of our helpers

currentoor22:04:59

right now I'm getting "Assert failed: :mockdb has no Schema in dbs of app config." when i try to use with-db-fixture

currentoor22:04:17

how do i specify the config for the db created by with-db-fixture?

tony.kay22:04:01

name it after your production db, which is alrady configured

tony.kay22:04:30

on your local machine, your config file points to a dev db or in-memory db

tony.kay22:04:43

If you want, you could add an additional config section

tony.kay22:04:58

:report-center is the name of your db

currentoor22:04:05

so are you saying I should do (with-db-fixture report-center ...)?

tony.kay22:04:11

yes, I think so

currentoor22:04:31

hmm i'll restart my repl but that doesn't seem to be workign

ethangracer22:04:41

no, changing the name of the symbol won’t matter

tony.kay22:04:48

right, not the symbol

ethangracer22:04:01

you have to specify the correct :migrations directory

ethangracer22:04:26

that’s the only thing I imagine would be causing your error

tony.kay22:04:38

right..it needs no config...forgot

tony.kay22:04:42

:migrations and :seed-fn

ethangracer22:04:59

:migrations is required, :seed-fn is optional but recommended

currentoor22:04:16

where do i add these entries?

ethangracer22:04:26

at the bottom of the with-db-fixture form

ethangracer22:04:33

it’s included in the snippet but kind of hard to see

currentoor22:04:50

oh, didn't notice that 😄

ethangracer22:04:38

the basic format is (with-db-fixture pick-a-name-here (form to evaluate and write tests here) :migrations “app.migrations.package” :seed-fn (call me to seed the database)

currentoor22:04:57

cool, it works now!