Fork me on GitHub
#re-frame
<
2019-01-31
>
Braden Shepherdson20:01:03

is there any kind of... canned controllers for re-frame?

Braden Shepherdson20:01:20

I mean, things bigger than "components", things like a master-detail flow, or a table with slice-n-dice filtering.

Braden Shepherdson20:01:33

because if not, I'm planning to build one <_<

lilactown20:01:23

it can be a little difficult to build "canned" components for re-frame because it needs to have all of the subscriptions/effects/etc. registered in the global registry

☝️ 5
lilactown20:01:13

so you need to make sure you namespace your keywords, and design it in a way that is flexible enough that applications can easily include and hook into it

danielcompton20:01:31

@lilactown yeah, another way to do it is that you let the caller provide the keywords to be used when registering things

Braden Shepherdson20:01:42

that's more or less what I'm planning

mattly21:01:03

I'm heading toward the path of having components take subscriptions in their arguments

mattly21:01:22

so the constructor of the component creates the subscription that provides the data

mikethompson22:01:16

@mattly @braden.shepherdson remember that subscribe takes a vector as its argument, and with components, that vector normally includes an id of some kind to identify the data on which the component is operating. And often that id is really a path within app-db. So your component needs to take arguments, which are path-ish ids, and then you can assemble the vector which is given as an argument to the subscribe. The same can happen with any component-embeded dispatch

mattly22:01:46

i do this in some places as well

mattly22:01:57

dispatching event handlers after an ajax call for example

mattly22:01:08

er wait that's dispatching not subscribing

mikethompson22:01:52

Apologies if I'm stating the obvious ... but the key insight is that the argument is both subscribe and dispatch is data (a vector). As a result, that data can be "assembled" within a component.

mikethompson22:01:40

@mattly I'm stressing this point because you talked about components taking subscriptions as arguments. Better, i think, to make the components take data as arguments - data which is then used (within the component) to construct the argument which is given to a subscribe (or dispatch)

👍 5
mikethompson22:01:42

So I'm encouraging you to be slightly more data oriented.

mattly22:01:30

the thing I work on with re-frame most these days is mostly a internal developer-oriented debugging tool

mattly22:01:58

and as such I've found that I need a lot of "generic" viewing components that can point at any number of data sources

mattly22:01:31

so this practice has stemmed from, I don't want to invent a query grammar on top of subscriptions

mikethompson22:01:33

Fair enough. Hard for me to comment further on the specifics of your case.

mikethompson22:01:46

Just trying to throw out ideas