mount

tolitius 2016-07-15T03:41:42.000590Z

@jocrau: can you share the actual use case for this? we have discussed this here (slack channel) a bit before, and there was an idea of creating atom like watchers in mount, where (in your case) meta-data may change its value "on event". but before even attempting anything like it, I'd like to understand the real need a bit better, because it just might be solved differently: i.e. no defstate needed at all, just an atom with a watcher

jocrau 2016-07-15T16:43:52.000599Z

@tolitius: The use case is to load some seed data on the CLJS side via a GET request. All namespaces that depend on the data should be able to just deref meta-data. The HTTP library that is used (cljs-http) returns a async channel. What I would like to put in the meta-data state is of course the body of the response. The problem is not only, that the "wrong" value ends up to be the state, but also that (go ..) returns immediately (which is the whole purpose of it). As a result, the other states don't "wait" for the meta-data to be loaded. My current solution is to have a function (with-seed-data mount/start) that calls the callback function mount/start once we received the response.