Fork me on GitHub
#re-frame
<
2019-02-21
>
mikethompson02:02:56

So you are saying you see: 1. (.log js/console "router @" r) fires 2. You do not see a transition from home/page to [:div "Page 2"]

mikethompson02:02:29

If yes, my next question will be "what is home/page?"

Nolan02:02:41

no @mikethompson, i see the log messages fire for either of the subscription methods, but not the router's log message

Nolan02:02:56

where the router is subscribed to those subscriptions

mikethompson02:02:42

So (.log js/console "result 2" result) shows a different value to the last time

mikethompson02:02:50

BTW, are you using re-frame-10x?

Nolan02:02:57

yes, and yes

mikethompson02:02:40

So re-frame-10x should show that the subscriptions have re-run and also show you that a different values has been delivered in each case?

Nolan02:02:40

i believe that is what re-frame-10x shows

Nolan02:02:03

the app-state definitely changes

Nolan02:02:24

and the Subs tab, seems to show that the subs were executed

mikethompson02:02:36

I'm just checking to make sure the subscription actually delivers a new value. It may run ... but if it delivers the same value as before, then there's no need for the view to rerender

mikethompson02:02:00

So that would be my first check.

Nolan02:02:06

it is a different value, i will try to include screenshots

mikethompson02:02:29

No, i believe you.

mikethompson02:02:24

I'm a bit stumped.

mikethompson02:02:43

Can't think of a different reason why there'd be no rerender

Nolan02:02:17

yeah, i am quite confused myself

Nolan02:02:12

i also implemented a simple counter, with a button that increments the count, and that worked perfectly fine

Nolan02:02:26

i used the same approach as the router above

mikethompson02:02:59

Hmm. So in summary: 1. @(rf/subscribe [:active-panel-name]) returns a different value but ... 2. A renderer which uses that subscription does not rerender.

Nolan02:02:58

yes, seems so

Nolan02:02:55

seems i can't upload images here

mikethompson02:02:11

Click on "diffs" check box in subscriptions to be sure there are really different values

mikethompson02:02:25

I saw images for a short time

mikethompson02:02:20

So ... what you are doing is right. But if you were doing it right, then it would work. So we are being tricked somehow. But I can't work it out

mikethompson02:02:41

Worse, I have to go.

Nolan02:02:47

the diffs read

ONLY BEFORE
:home
ONLY AFTER
:about

mikethompson02:02:59

That's certainly a change !!

Nolan02:02:26

ah, well, i certainly appreciate your time! thanks

mikethompson02:02:01

:about is not in your case

Nolan02:02:32

oh, sorry, i changed it to about after the fact

mikethompson02:02:33

Which makes me wonder what (get-in active-panel [:data :name]) returns

Nolan02:02:44

but i changed it throughout the app

mikethompson02:02:46

could be a nil ?

mikethompson02:02:07

Grasping at straws

Nolan02:02:13

no, i changed :page2 to :about everywhere, the problem is the same 😕

Nolan02:02:20

sorry for the confusion

mikethompson02:02:00

Are you sure router is actually rendered?

mikethompson02:02:12

Perhaps there's a different view function

mikethompson02:02:25

And you are staring at the wrong one

mikethompson02:02:29

More grasping at straws

Nolan02:02:40

the home/page is rendered through the router, so i'm reasonably sure

Nolan02:02:57

plus, the router's log message gets logged to console on start-up

Nolan02:02:02

not sure what it means, but i was just looking through the traces in re-frame-10x, and i see some :sub/disposes at the end

mikethompson02:02:17

This is bugging me. Can you change your case so instead of

(case r
      :home  home/page
    ... 
you have
(case r
      :home  [home/page]

mikethompson02:02:54

I can't remember what you said home/page was

mikethompson02:02:25

So I'm guessing here

Nolan02:02:34

oh, y'know what....

Nolan02:02:40

that fixed it, i think

Nolan02:02:57

wow, yeah

mikethompson02:02:30

So explanation: If a renderer ever returns a function, then that function will be made the new renderer

mikethompson02:02:46

Replacing the existing renderer for that component

mikethompson02:02:57

That is how Form-2 components work

Nolan02:02:17

i see, i should review that more

Nolan02:02:29

thanks for the help!!

Nolan02:02:43

i've been trying to figure it out all day 😀

Nolan02:02:49

yes indeed, cheers

Whiskas13:02:25

Which chart lib do you guys like using with clojurescript?

stathissideris17:02:20

when making a reusable component, which approach is best: (1) deref the subscription in the parent and pass pure data to the component (2) pass the name of the subcription and have the component subscribe to it

mikethompson20:02:20

@stathissideris path 2 is probably better. because path 1 will cause an unnecessary rerender of the parent when the subscription changes.

stathissideris20:02:43

@mikethompson ok, but I guess (1) is ok if the parent was going to be re-rendered anyway. Thanks!

mikethompson20:02:02

@stathissideris Overall, our general rule is to create subscription as close as possible to their use. On the other hand path 1 can make some kinds of testing easier.

mikethompson20:02:17

Because the child is more of a pure function

mikethompson20:02:06

(Not that you are suggesting this but ...) One thing that we have found ends badly is passing subscriptions themselves from a parent to the child.

stathissideris20:02:46

I haven’t tried that last one because I saw no documentation suggesting that it would work. I usually just pass the keyword.