You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Since components have callbacks as arguments, do they always rerender? #146
Since reagent using identical? to see if it has to rerender a component, does the fact that recom components take callbacks as arguments mean that this optimization can never work, even if all the other props are identical?
If this is true, I suppose a solution is to pass in globally defined functions. That is a bit inconvenient however, because you can't close over local variables.
If you create the callback in-line, then it will not test identical? to previously. But if you create a Form-2 reagent function, and create the callback in an outer function for use within the renderer, then it will test identical? each time.
Activity
mike-thompson-day8 commentedon Apr 9, 2017
If you create the callback in-line, then it will not test
identical?to previously. But if you create a Form-2 reagent function, and create the callback in an outer function for use within the renderer, then it will testidentical?each time.pesterhazy commentedon Apr 9, 2017
Note that if you re-create the same anon fn twice, not only will it be not
identical?but also not=:pesterhazy commentedon Apr 9, 2017
I've created a live demo of @UrKr's difficulty: https://gist.github.com/pesterhazy/36b56d1bd8b424abef81adbb5a392d93 (scroll down for the link)
mike-thompson-day8 commentedon Apr 9, 2017
Yep, covered here:
https://github.com/Day8/re-frame/blob/master/docs/Performance-Problems.md#4-callback-functions
@UrKr are we good to close?
UrKr commentedon Apr 9, 2017
@mike-thompson-day8
Yes. Thank you both for the quick replies!