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
Could I suggest that you add a clearChanges() function to Cortex. This would have the side effect of making a ssubsequent call to didChange() function return false again (unless there was infact another cortex change.
The use case would be
onUpdate(updatedData) {
React.render({model: updatedData}) //it can fully utilise the didChange() for render optimisation
updatedData.clearChanges() //this ensures that subsequent React re-rendering base on prop or state outside of cortex control can be optimised alongside a properly working cortex.didChange() call which now returns false when it did not change since the last clearChanges()
}
The text was updated successfully, but these errors were encountered:
This is a good idea, but one danger with something like this is you have to guarantee it's only called at the very end of the render loop. I don't think you can simply call it in onUpdate callback because there's no way to be sure react finishes rendering all its components. I'd rather make this an option and hook into react componentDidUpdate to prevent users from improperly calling it.
Could I suggest that you add a clearChanges() function to Cortex. This would have the side effect of making a ssubsequent call to didChange() function return false again (unless there was infact another cortex change.
The use case would be
onUpdate(updatedData) {
React.render({model: updatedData}) //it can fully utilise the didChange() for render optimisation
}
The text was updated successfully, but these errors were encountered: