bhauman / devcards

Devcards aims to provide a visual REPL experience for ClojureScript
1.53k stars 113 forks source link

feature suggestion: component reload policies #26

Open wilkerlucio opened 9 years ago

wilkerlucio commented 9 years ago

While developing here I'm noticing that I'm having to manual reload a lot (mostly by renaming the card that I'm working on). I saw what you said about data reloading at the issue #15, but at same time, when you change data on your video demo it reloads (there you are using Sablono, not sure if it matters).

I noticed my cards only get re-render if I interact with then or remove/add/rename, and I think the workflow could be much better if they just re-render all the times when reloading (or maybe even on a render loop).

I propose that we have some sort of settings for how to deal when code updates, it could be an extra key at the configurations like :reload-policy, and here and some ideas for values of it:

So we could write:

(defcard-om sample-om-card
  component
  {:data 1}
  {}
  {:reload-policy :refresh})

These are just ideas to deal with the problem of having to manually reloading the cards against code changes, please let me know your thoughts/ideas on that matter.

Thanks.

bhauman commented 9 years ago

Try :watch-atom true this causes om to re-render on reload.

bhauman commented 9 years ago

I really like this idea though. I haven't worked extensively with the cards and om. Om is conservative with it's rendering, only rendering when data changes. There are other tricks to working live as well. I may make :watch-atom default to true for Om for now. I'm going to work on the Om example page next so that I can see all these edge cases and have a good idea how to plan for refreshing them properly. But if you want to work on the devdemos.om page feel free.

wilkerlucio commented 9 years ago

Sure, I'll try to implement something like that myself later, I'll let you know if I ran in any issues with the codebase. Thanks.

wilkerlucio commented 9 years ago

And I agree with the :watch-atom true to be default for Om for now, will be very helpful until there is a better solution.

bhauman commented 9 years ago

watch atom true deployed!