bhauman / devcards

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

[reagent] initial-data isn't IReactiveAtom #90

Closed Frozenlock closed 8 years ago

Frozenlock commented 8 years ago

The initial-data passed to the Reagent components doesn't implement the IReactiveAtom protocol.

This makes some Reagent features, such as the cursors, unusable in a component rendered with devcards.

bhauman commented 8 years ago

Frozenlock you are aware that you can pass a RAtom into a card as :initial-data like so? https://github.com/bhauman/devcards/blob/master/example_src/devdemos/reagent.cljs#L215

You can even make it an ratom inline like so (r/atom {:counter 0})

But you are right, we could make sure that default initial-data is converted or initialized as an ratom here: https://github.com/bhauman/devcards/blob/master/src/devcards/core.clj#L154

Frozenlock commented 8 years ago

I did not know! Thanks for the info.

This makes things much easier. Feel free to close this issue; using ratom as initial data solves pretty much everything.


I even just realized that the 3 example links from the readme point to particular namespaces and that a bunch of others (such as the one you linked) are available if you click on the top devcard link.