Fork me on GitHub
#fulcro
<
2023-03-24
>
greg14:03:01

Is it possible to defer mount until some initial df/load succeeded? Eg. to load initial translations before first render

Jakub Holý (HolyJak)18:03:49

Do the transaction in https://github.com/holyjak/minimalist-fulcro-template-backendless/blob/main/src/com/example/client.cljs#L9-L15 and only do app/mount! when you are ready. Fulcro can work fully headless so that is fine.

👍 2
Jakub Holý (HolyJak)18:03:26

Perhaps use a post-mutation in df/load to do the actual mount! call.

👍 2
tony.kay20:03:01

I either use UISM or statecharts to define my app startup (including login), because it is usually a pretty complex sequence: load config stuff, resume session, possibly load user-related data, etc etc. In terms of mount/don’t mount: What Jakub said is true, but in real production applications I want immediate user feedback, and I usually prefer to go ahead and mount, but put some kind of root flags/progress indicators in state. Then I make the HTML start with some kind of app loading HTML that the root component mimics so that you get immediate feedback even before the js has loaded. As the app starts I mess with the root flags to update the progress in the UI. E.g. the simplest is just a :ui/ready? on the root, where the Root component has

(defsc Root [this {:ui/keys [ready?}]
 {...}
 (if ready?
   (render-app)
   (render-loading)))

👍 4
❤️ 2