metasoarous / datsys

(+ clj cljs datomic datascript re-frame-esque-frp)
Eclipse Public License 1.0
231 stars 25 forks source link

Sente connections should only fetch bootstrap first time #13

Open metasoarous opened 8 years ago

metasoarous commented 8 years ago

This tends to work best for most development workflow; page refresh works fine for resourcing db, given how often this is needed.

bamarco commented 8 years ago

I think I figured out part of the problem. In ws.cljs you have a lot of initialization not hidden behind a defonce. So all the sente get-flexi-packer defs and the (sente/start-chsk-router! ch-chsk event-msg-handler) get called everytime you save a file not just on refresh. This forces you to use the opened? atom hack (which is defonced as it should be).

Besides the above did you want it to bootstrap once per figwheel startup or once per refresh?

metasoarous commented 8 years ago

Good find! This should get taken care of in the System Component rewrite. If not we can revisit it.

I was thinking bootstrap once per figwheel session, forcing refresh when you want to retry the bootstrap. I think mostly you won't need to bootstrap if we set things up properly, because posh will take care of telling the server what data is needed. So there shouldn't need to be a lot of tweaking of the bootstrap function eventually, and till then reloading is fine. I think. Open to thoughts.

bamarco commented 8 years ago

By "System Component rewrite" do you mean setting up the front end to also use stuartsierra.component? [Yes. Answered my own question.]

Yeah I figured it should be a one off. If that's the case there's probably a way to set it up in the dev/user.clj similar to the Chestnut method and just start figwheel from the run fn. Have a bootstrap function that gets called in dev/user.clj in dev mode and called from Component in production mode.

metasoarous commented 8 years ago

Yup :-) Take a look at the grand-refactor branch.

I'm totally open to improvements and streamlining on the interactive dev side. Just open an issue for it so we can discuss and then PR.