This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-05
Channels
- # beginners (29)
- # boot (29)
- # cider (54)
- # cljs-dev (99)
- # cljsjs (31)
- # cljsrn (39)
- # clojars (32)
- # clojure (171)
- # clojure-austin (2)
- # clojure-berlin (5)
- # clojure-brasil (3)
- # clojure-greece (2)
- # clojure-italy (1)
- # clojure-korea (11)
- # clojure-spec (202)
- # clojure-uk (166)
- # clojurescript (130)
- # cursive (54)
- # datomic (99)
- # dirac (18)
- # figwheel (6)
- # hoplon (23)
- # lambdaisland (3)
- # leiningen (8)
- # luminus (14)
- # off-topic (11)
- # om (3)
- # om-next (24)
- # onyx (59)
- # planck (25)
- # protorepl (10)
- # re-frame (49)
- # reagent (14)
- # ring-swagger (2)
- # rum (46)
- # schema (1)
- # slack-help (6)
- # specter (7)
- # testing (7)
- # untangled (115)
- # yada (1)
@martinklepsch can you log that request in the issues? Otherwise I'm afraid I can forget about it
Pretty cool I think š
Makes global state a bit more ācontrollableā š
Nice work, one think that I'm pretty surprised is how you use rum for start the system. In my mental mode, I will done the same process but in reverse order. The system will start the ui (not the ui that starts the system)
@niwinz using it with Potok like this btw:
(rum/defc system-wrap < (sys/system (new-system store))
{:will-mount (fn [s]
(js/console.log "Injecting system" (::sys/system s))
(ptk/emit! (:store (::sys/system s)) (->System (::sys/system s)))
s)}
[root-comp]
(root-comp))
It makes me feel strange that the UI part of the app is responsible to start the rest of the stuff.
Hm, interesting thought, never considered turning the UI into a component. I think since everything is āexportedā via component context it might not be possible but not sure
In my mental mode, UI is just a part of the system that should be started from the main entry point, and it has its dependencies
starting UI and on mount start the rest of the system looks very strange on my mental model
Well the system is started before the UI is mounted
i.e. Nothing is rendered before the system has started
In my approach, I will have functions that starts the system and UI is jut a part of it
so the approach of having UI just a component makes very easy just don't include it when on tests builds
> so the approach of having UI just a component makes very easy just don't include it when on tests builds Or you just start the system and donāt have the UI at all
I donāt see a big difference in that regard but in theory Iād say you are right. UI depends on other stuff in the system and could be treated as component
@niwinz I can just do (component/start (new-system store))
on the other hand you will have to repeat the same logic of initialization on tests and ui
(js/console.log "Injecting system" (::sys/system s))
(ptk/emit! (:store (::sys/system s)) (->System (::sys/system s)))
Ah, you mean that, I see
Yeah, that would have to be done manually. Not a huge deal though Iād say
But as I said, I agree. UI could be a component like others that depends on parts of the system
it's not huge deal, but I prefer just having to no repeat initialization logic, just because it can change in future and you should not forget to change it on other locations
I actually do the same, start my whole app from the root App
component and do a bunch of initialization on will-mount etc
@rauh clean slate as in all data wiped out? If you repeat initialization logic on updates you probably construct some state outside that logic?
@martinklepsch I guess I didn't mean that. I do a whole remount but my state lives in two places: Datascript + component local state. Both persist the reloads.
So I actually get the same state, or else I have a bug in my SPA and need to remember some local state.
@niwinz toyed briefly with the "UI is a componentā idea, definitely seems possible but itās probably where Iāll stop and call it pragatism š
On my apps I'm not using component nor mount, but I first start router, the potok stream and other stuff, and then the UI. I understand that your approach also works well, it just looks strange to me.
@martinklepsch Have you or anyone else you know tried using javelin with rum? Is that even possible? I like hoplon/javelin ā but not ideal if wanting to do native mobile - and leverage react-native. How are you storing data for rum apps?
@donmullen in an atom and then I use derivatives https://github.com/martinklepsch/derivatives
Have never used Javelin so I canāt really compare
(there are plenty of alternatives to derivatives)