Enable selective React rendering with useMachine? #1621
-
|
Currently, in This is a pretty solid heuristic that should apply for almost all use cases, but breaks down when there is an action that updates context and that context change is intended to be read outside the React render loop (eg. rAF). A concrete example is animation. Suppose you have an event handler that fires anywhere from 4-66hz and provides the progress of an audio track. In my case this event handler updates a reference that is read somewhere else and produces an animation outside the React render cycle. This reference must also be part of machine context, because guards depends on its value. It would be nice if there was a way to block updating React state for actions that just update this reference in context, because otherwise you incur an intense amount of React rendering. I propose adding a predicate to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Do you have a more complete code example? If there are any actions, Also, this PR for adding a filter option might be of interest: #1514 Would this be applicable? |
Beta Was this translation helpful? Give feedback.
Do you have a more complete code example? If there are any actions,
state.changedwill be true.Also, this PR for adding a filter option might be of interest: #1514 Would this be applicable?