This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
Suspend event listeners during reconciliation? #71
Labels
feature: idea
Proposed feature, but not on the roadmap.
A common source of bugs in Roact code that I've seen involves hooking into
Changed
or usingGetPropertyChangedSignal
, and callingsetState
in response.This pattern is perfectly fine as long as the reconciler doesn't affect the properties you're listening to synchronously. I use this technique in my Roact Windowing example to make the windowing responsive to your current scroll position.
One idea that @AmaranthineCodices had would be to suspend those events while the reconciler is running, eliminating that entire class of bugs.
Are there any cases where you'd want these events? It's only problematic when you end up calling
setState
directly or indirectly.The text was updated successfully, but these errors were encountered: