Fork me on GitHub
#mount
<
2016-03-16
>
taylor.sando04:03:27

How hard would it be to adapt yurt so that it could be used with clojurescript? I'm going to need a unique yurt for each devcard. Is this just better suited for using component?

tolitius20:03:59

theoretically it should work for development, the way it is written currently won't work in the :advanced mode

tolitius20:03:05

from not thinking too deep about it, I don't think it is hard to make it work for :advanced mode

taylor.sando20:03:18

That's not a huge deal for devcards not to have advanced mode

tolitius20:03:57

I honestly did not think there is an interest of yurt in cljs simple_smile, but the point is valid

taylor.sando20:03:42

For the main application it doesn't. I can some it being somewhat helpful for testing.

taylor.sando20:03:19

You could get away with it potentially if there was only one devcard per page.

tolitius20:03:20

I have not used devcards, but it would be strange to architect an app in one way to work with devcards and in another way to work in prod? I might be missing something?

taylor.sando20:03:18

The problem would be that each devcards is kind of like it's own self-contained thing running. It would need references to mount states, and multiple devcards would clobber each other's states.

tolitius20:03:04

right, I understand, but yurt is not really a drop in replacement for mount

tolitius20:03:26

there are a couple of gotchas

tolitius20:03:08

the first one is not a problem, since you can return a map from start functions that would later be passed on to stop functions

tolitius20:03:21

the second one would depend on the way you'd design your app

tolitius20:03:46

i.e. for example, do you see how db is passed as a value to make routes?

tolitius20:03:59

in mount you would probably just require it use it: i.e. (`require [app.db :as db]` ... (routes ... (GET "/foo" (do-somm-with db))))

tolitius20:03:06

since by the time the yurt is created it is completely detached from existing vars, so you can create more yurts

tolitius20:03:26

hence you can't really reference the vars globally in your code with yurt

tolitius20:03:26

the whole idea was to prove that Clojure vars are not bad and can be also used to build multiple systems within the same runtime

taylor.sando20:03:15

My app had a fair bit of dependency injection already. I'll probably just not use mount for the devcards part. I don't think it is that critical to make it work.

tolitius20:03:02

yea, sorry, I might need to blog about it a little bit. I really did not think there would be any interest in yurt and wrote it specifically for a Clojure Remote talk to prove the point, but I see there are several people who actually like it and want to use it.. /needs thinking simple_smile

taylor.sando20:03:19

devcards is kind of a unique case, because it's not quite deftests where you are using fixtures, or starting/stopping at the test boundaries. It can continue running

tolitius20:03:40

yep, makes sense. can you give a simple example of two devcards that won't work together (to amplify the thinking)?

taylor.sando20:03:40

It would be using om next and datascript. I would assume that the two devcards would be using the same datascript instance, which isn't what you'd want.

tolitius20:03:34

just wondering... can two devcards be created with a different config? (i.e. datascript connection string..)

taylor.sando20:03:58

I would assume they'd both still be referencing the same mount state though, say client.db/conn

tolitius20:03:01

I presume this is the core point / feature of devcards simple_smile but.. what would be the reason of having two different devcards.. i.e. how are they different?

taylor.sando20:03:07

Sometimes to see how things change based on different configurations. I guess you could just go with one card per page.

taylor.sando20:03:05

I guess it's a choice between having multiple cards or having mount. It might make more sense just to have single cards for components. I have usually just had one anyways. I wouldn't be able to put any deftests on them, but they could go on separate pages where I could control the mount start/stop more explicitly.

taylor.sando20:03:54

I'll just the workflow using mount and see if I like it.

tolitius20:03:43

cool, let me know. meanwhile, I'll read about devcards, thanks for the question though