devcards

Devcards aims to provide a visual REPL experience for ClojureScript https://github.com/bhauman/devcards
mattsfrey 2016-07-25T16:47:36.000075Z

has anyone developed any successful strategies / best practices for developing components with devcards that use re-frame state?

2016-07-25T17:28:40.000076Z

I’ve heard someone talking about separating individual re-frame instances in iframes

shaun-mahood 2016-07-25T17:31:41.000077Z

Reposted from Clojurescript channel for completeness Best I've seen so far can be found at https://github.com/nberger/devcards/blob/iframe/example_src/devdemos/re_frame.cljs with a brief discussion about it near the bmottom of https://clojurians-log.clojureverse.org/re-frame/2016-07-15.html I'm hoping to put some time in this week to get something written up in the re-frame and devcards wikis if I can get something working with it

2016-07-25T17:34:22.000080Z

you could also try my library https://github.com/binaryage/pure-frame, but it has only v0.5 compatible interface

2016-07-25T17:35:42.000082Z

didn’t have need to really advance it further, will probably do with my next re-frame-based project 🙂

shaun-mahood 2016-07-25T17:36:57.000083Z

@darwin: Are you planning to update pure-frame to match re-frame as it changes (particularly for v0.8)? Or any plans for other divergences? It does look interesting for sure.

2016-07-25T17:38:01.000084Z

I’m not going to maintain it just for the sake of maintaining it. Only if I needed it for my next project (not planned at this point).

2016-07-25T17:38:39.000085Z

frankly I don’t follow new re-frame development closely because I don’t actively work on any re-frame-based project ATM

shaun-mahood 2016-07-25T17:41:06.000086Z

Sounds reasonable to me. Re-frame v0.8 looks like it will bring a few interesting changes at least.

1👍
mattsfrey 2016-07-25T17:45:16.000087Z

not a huge fan of having to use iframes etc,

mattsfrey 2016-07-25T17:45:37.000088Z

has anyone tried using the same db instance across cards?

mattsfrey 2016-07-25T17:47:39.000089Z

(I'm just checking out devcards too so I apologize for being fairly ignorant about how that works as well)

shaun-mahood 2016-07-25T17:48:34.000090Z

@mattsfrey: If you read through the link, there are a couple demos showing what happens without iframes - I haven't seen anyone come up with a better idea than iframes yet unfortunately, but at least they are limited to only affecting the devcards part.

shaun-mahood 2016-07-25T17:52:43.000091Z

devcards is a pretty fantastic tool for design and testing so definitely keep trying it and asking questions. The way I used it in the past with re-frame (without iframes) was to design and test reagent components that had no reliance on the re-frame app-db, then wire them up with subscriptions and handlers in the web app - can't test quite as much that way, but I found it forced me to follow a pretty good design that fit very well with re-frame. Maybe try it out that way and see if you need to go further for your purposes.

mattsfrey 2016-07-25T18:17:53.000092Z

Yeah so this might be interesting but our app is setup so that there are no subscriptions

mattsfrey 2016-07-25T18:18:21.000093Z

we basically create a data namespace that correlates to each view and have functions inside them that wrap reactions to a piece of the db state

mattsfrey 2016-07-25T18:18:33.000094Z

and then dereference those functions in the component to access state

mattsfrey 2016-07-25T18:19:47.000095Z

so I'm thinking it might be possible to do this by using an intermediary "outer" component which defines the references to these reactions and then passes them dereferenced as props to an "inner" component that just simply does rendering based on those props

shaun-mahood 2016-07-25T18:30:14.000096Z

@mattsfrey: Sounds like it has potential, that's essentially the way I did things originally - the only things that went into devcards were the "pure" inner components. You still might run into problems with handlers changing the state of other cards, though. I would be interested to hear how well it works for you. Out of curiosity, is there a particular reason you don't use subscriptions in your app?

mattly 2016-07-25T18:44:11.000097Z

@mattsfrey: that's an interesting approach, I'd love to see a simple example of what it looks like in practice

mattsfrey 2016-07-25T18:48:37.000098Z

The guy who set it up before I started did it this way and I unfortunately haven't had a thorough discussion on the whys of it

mattsfrey 2016-07-25T18:48:51.000099Z

but i'm guessing he liked the concept of keeping signals as pure functions versus the global subscriptions system

mattly 2016-07-25T18:49:21.000100Z

ah

mattly 2016-07-25T18:49:33.000101Z

yeah I had been thinking about something similar

mattsfrey 2016-07-25T18:58:25.000103Z

this is sort of the gist of it

mattsfrey 2016-07-25T19:03:34.000104Z

(just updated for some mistakes)

bhauman 2016-07-25T19:32:02.000105Z

just want to throw this out there: https://github.com/bhauman/devcards/issues/105

bhauman 2016-07-25T19:32:32.000107Z

it looks like it should be part of this discussion

shaun-mahood 2016-07-25T20:28:12.000108Z

Definitely, thanks Bruce