(fix) Reduce re-render churn in FormProcessorFactory#670
Open
(fix) Reduce re-render churn in FormProcessorFactory#670
Conversation
…e churn In the FormProcessorFactory, there's serious potential for render cascades from the combinations of `useEffect()` and `setState()` that then trigger additional `useEffect()` and `setState()` calls. This commit switches to more aggressively caching some of these key hooks so that there's less potential for these cascade to lead to catastrophic reloading issues.
This is basically done by splitting the processor context into a "static" part that is derived from the form itself and a "dynamic" part that may be updated by components downstream of the FormProcessorFactory. This mostly should optimize things so that components that depend on the processor context should mostly get stable objects, assuming they correctly use the properties of the processor.
|
Size Change: +246 B (+0.02%) Total Size: 1.42 MB ℹ️ View Unchanged
|
denniskigen
reviewed
Dec 4, 2025
src/components/processor-factory/form-processor-factory.component.tsx
Outdated
Show resolved
Hide resolved
…ent.tsx Co-authored-by: Dennis Kigen <kigen.work@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requirements
Summary
In the FormProcessorFactory, there's serious potential for render cascades from the combinations of
useEffect()andsetState()that then trigger additionaluseEffect()andsetState()calls. This PR switches to more aggressively caching some of these key hooks so that there's less potential for these cascade to lead to catastrophic reloading issues.Secondary to that, this also tries to make the
processorContextmore stable by essentially dividing it into parts that are set by the FormProcessorFactory (the "static" parts) and parts that are set by child hooks and components (the "mutable" parts). This, hopefully, should reduce the render churn in downstream components.Unrelatedly, this sets a fixed timezone for tests, as the current batch fail in UTC negative timezones like the US east coast.
Screenshots
Related Issue
Other