mount

2016-03-16T04:34:27.000006Z

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?

tolitius 2016-03-16T20:04:24.000007Z

@taylor.sando: good question.. :simple_smile:

tolitius 2016-03-16T20:04:59.000008Z

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

tolitius 2016-03-16T20:06:05.000009Z

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

2016-03-16T20:06:18.000010Z

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

tolitius 2016-03-16T20:06:57.000011Z

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

2016-03-16T20:07:42.000012Z

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

2016-03-16T20:08:19.000013Z

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

tolitius 2016-03-16T20:08:20.000014Z

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?

2016-03-16T20:09:18.000015Z

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.

tolitius 2016-03-16T20:10:04.000016Z

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

tolitius 2016-03-16T20:10:26.000017Z

there are a couple of gotchas

tolitius 2016-03-16T20:10:48.000018Z

take a look at yurt sample app: https://github.com/tolitius/yurt/tree/master/dev/clj

tolitius 2016-03-16T20:12:10.000020Z

two gotchas are: * https://github.com/tolitius/yurt#stop-functions * passing states to functions: https://github.com/tolitius/yurt/blob/master/dev/clj/neo/www.clj#L20

tolitius 2016-03-16T20:13:08.000022Z

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

tolitius 2016-03-16T20:13:21.000023Z

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

tolitius 2016-03-16T20:13:46.000024Z

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

tolitius 2016-03-16T20:14:59.000025Z

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

tolitius 2016-03-16T20:16:06.000027Z

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

tolitius 2016-03-16T20:16:26.000028Z

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

tolitius 2016-03-16T20:17:26.000029Z

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

2016-03-16T20:21:15.000031Z

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.

tolitius 2016-03-16T20:23:02.000032Z

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:

2016-03-16T20:24:19.000033Z

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

tolitius 2016-03-16T20:24:40.000034Z

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

2016-03-16T20:25:40.000035Z

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.

tolitius 2016-03-16T20:26:34.000036Z

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

2016-03-16T20:28:58.000037Z

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

tolitius 2016-03-16T20:34:01.000038Z

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?

2016-03-16T20:37:07.000039Z

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

2016-03-16T20:39:05.000040Z

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.

2016-03-16T20:41:54.000041Z

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

tolitius 2016-03-16T20:57:43.000042Z

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

😡 1