Fork me on GitHub
#re-frame
<
2018-11-14
>
olivergg04:11:26

@deg ok thanks anyway. I'll try to contact the contributor. I'll let you know if I find something useful ;-)

olivergg16:11:52

@gabrielsimoes sorry to bother you, since you are the contributor of the firestore part in re-frame-firebase, have you tried something like this https://clojurians.slack.com/archives/C073DKH9P/p1542143767323400 Thanks 😉

Dormo22:11:48

Hi. I've been using re-frame for awhile. Overall I've been rather happy with it, but now that my application is growing, I've become a bit disenfranchised with the subscription aspect of it. To me, it see like it would be simpler to implement "events" and "effects" as multimethods, and then just have the view be one pure function that takes the app-state and passes it (and subsets of it) to reagent components. Am I missing something that subscriptions are meant to solve?

mikethompson23:11:14

You get various advantages from subscriptions: 1. a signal graph with propagation pruning (efficiency) 2. shared calculations (nodes) because there is a graph (efficiency again) 3. you can reoganise the structure in your app-db without changing your views because subscriptions mediate access. Also, I am personally not that keen on multi-methods. I get that they appear to be convenient but they come with costs. I'm normally very big on convenience, but multi-methods are a tradeoff I didn't want to make.

👍 8
mikethompson23:11:58

For example, if effects where done by multi-methods, how could you "stub out" an effect in a test?

Dormo23:11:03

Thank you for the thoughtful response. I will have to research signal graphs a bit, as I'm not familiar with the concept. Personally I'm not fond of #3. I don't like the idea of data being represented differently in different parts of the system. What exactly is the issue with multimethods?

Dormo23:11:28

With a :default method that simply logs not implemented?

mikethompson23:11:40

@vheuken regarding #3 what happens if a list needs to be sorted in one way in view X but should summarised in view Y. Same data. Different materialized view of it used in two places. That's what subscriptions give you.

👍 8
mikethompson23:11:23

We tend to write more complex apps. So we run into these kinds of things

mikethompson23:11:37

But I get this is not so much an issue with simplier apps

mikethompson23:11:09

I don't understand your comment about :default

mikethompson23:11:18

Sorry, gotta head out now.

Dormo23:11:25

Perhaps I don't really understand your comment on stubbing out an effect

Dormo23:11:09

I can see that use case, but I guess I'm not really sold on why that's more effective than a pure function where the app-state (or subset) is passed in and the "summarised" data returned. Though, like I said, I don't understand the performance implications.

Dormo23:11:11

No problem.

mikethompson23:11:45

Qucikly: in your proposal about passing app-db, you will rerender the entire app each time app-db changes? How will you know what part of app-db has changed? Effecting which parts of the DOM?

mikethompson23:11:59

Now, I really do have to go

Dormo23:11:25

I think I might be under the impression that Reagent/React are smarter than they actually are.

4
mikerod23:11:17

@vheuken yeah, I thinks you may assuming they do more then they do in that regard

Dormo23:11:20

I think that pretty much answers my question. Thanks 🙂

eternalNoob23:11:16

Hey people! I ran into an issue today with this view not re-rendering. I wanted to make sure if this is the best way to structure a view that is dependent upon parameterized subscriptions.

eternalNoob23:11:02

layout/column and layout/row are just wrappers over recom/v-box and h-box

Lu23:11:18

Use the @ symbol before your subscribe functions

mikethompson23:11:55

That's outside the render function

Lu23:11:17

Oops you’re totally right

mikethompson23:11:26

@uayyagari I'm guessing that arg1 changes over time?

mikethompson23:11:57

In which case you should put the arg1 in the render function

mikethompson23:11:09

Not the outer function

mikethompson23:11:18

And that, right there, will likely reveal the problem

mikethompson23:11:50

My guess is that you need to move the let inside the render functions (and change from a Form-2 to a Form-1). Thus moving the subscriptions (which use the changing value of arg1) into the renderer itself.

mikethompson23:11:08

Then you can use @lucio suggestion safely.

😂 4
eternalNoob23:11:54

@mikethompson Yes, it changes over time. Cool! Will try it out and let you know! Thanks!

mikethompson23:11:30

Remember, with a Form-2, the outer function is only ever called once (per component).

mikethompson23:11:50

The renderer is called many times (each time arg1 change?)