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
I recently found myself using this pattern more and more in a web app context using with React. Let's say I have a list of items and each list has an id:
I want to react to a change when the route is updated (change of list)
I want to command a refresh of the list after a mutation deep down the component tree.
I want to stick to the previous loaded list as long as possible during a refresh/load to avoid flashing.
Turns out lazyObservable offers 2 and 3 out of the box and to implement 1 I used an autorun in the fetch callback that reacts to the mutation of observables used in a keyProvider function:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi 👋,
I recently found myself using this pattern more and more in a web app context using with React. Let's say I have a list of items and each list has an id:
Turns out
lazyObservable
offers 2 and 3 out of the box and to implement 1 I used anautorun
in the fetch callback that reacts to the mutation of observables used in akeyProvider
function:Is it OK to do that or is there a better primitive for it?
Beta Was this translation helpful? Give feedback.
All reactions