I've often seen it recommended to separate code that updates/gets app-db, into their own functions so they can be re-used instead of encoding the same app-db path into many different event handlers. Has anyone come up with a good name for this? I have separate namespaces for events and subs, and I'm considering putting these functions into their own namespace if I find a good name.
Right now I'm considering crud
. I think our subs and effect handlers would be much cleaner if we had an own crud
namespace for every subpart of app-db.
Today I'm in a hammock considering if statecharts-clj can improve the maintainablilty of my re-frame app. Seems like it could orchestrate but there's some friction in fitting with the re-frame event loop. Love @wxitb2017's work (especially after discovering the :exec false flag). Gist with a https://gist.github.com/olivergeorge/29f189ab794527c3692e3160b0232246#file-authfsm-clj-L39. Need to flesh it out. Love how easy the machine is to reason about.
there is a #statecharts channel for discussing fsm related topics
I'd be interested to see some code doing some bootstrapping stuff. It's not immediately obvious how to do a re-frame async flow seen-all-of?
check for multiple independent loading actions.
For example, I considered how this might translate...
(defn bootstrap
[{:keys [db]}]
(let []
{:db {:ddb/state data/empty-db
:app/loading? true
:app/online? false}
:fx [[:dispatch [::init-db]]
[:dispatch [::init-outbox]]
[:dispatch [::init-netinfo]]
[:dispatch [::init-appstate]]
[:dispatch [::load-token]]
[:dispatch-later [{:ms 5000 :dispatch [::bootstrap.timeout]}]]
[:async-flow {:id ::bootstrap-flow
:rules [{:when :seen?
:events [::init-db.resolve]
:dispatch [::load-datoms]}
{:when :seen?
:events [::load-datoms.resolve]
:dispatch [::init-sentry]}
{:when :seen-all-of?
:events [::netinfo-connection-status-update
::load-datoms.resolve
::load-token.resolve
::init-outbox.resolve
::init-sentry.resolve]
:dispatch [::bootstrap.succeeded]
:halt? true}
{:when :seen-any-of?
:events [::log-exception ::report-anomaly-to-user ::bootstrap.timeout]
:dispatch [::bootstrap.failed]
:halt? true}]}]]}))
Hello! Maybe its a frequent question but how can i run backend in re-frame template?
What re-frame template are you referring to?
lein re-frame
This link says lein watch
: https://github.com/day8/re-frame-template#run-application I am used to lein run
myself.