bhauman / bhauman/devcards

feature suggestion: component reload policies

Open
#26 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Clojure
Stars
1.5k
Forks
106
PR merge metrics
No merged PRs in 30d

Description

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:
- `:none` - this is like the current one, the component doesn't re-render on code reload
- `:render` - just re-render the component keeping the state (the props on the atom)
- `:refresh` - render all over again with the data on code (discard current state)

So we could write:

``` clojure
(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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.