[Fast Refresh] Make edits to a memo comparison function take effect - #36964
Merged
Conversation
sophiebits
marked this pull request as ready for review
July 8, 2026 07:20
gaearon
approved these changes
Jul 8, 2026
sophiebits
disabled the stack merge
July 8, 2026 16:11
sophiebits
force-pushed
the
fresh-type-changes/memo-comparison
branch
from
July 8, 2026 16:11
eda886e to
2e285a1
Compare
Editing the second argument of memo() previously never took effect until something else remounted the tree, for two separate reasons: - When adding a comparison function, we need to switch from SimpleMemoComponent to MemoComponent so canPreserveStateBetween should return false. - MemoComponent was missing from the hot reload type resolution in createWorkInProgress, so existing fibers kept reading .compare from the old memo object forever. New behavior: - Adding or removing the comparison function remounts; we need to do this when adding (SimpleMemoComponent doesn't support a comparison function) so let's also do it when removing. - Editing the comparison function implementation applies in place with state preserved The TODO in isCompatibleFamilyForHotReloading is removed as that wasn't the right place to do this check.
sophiebits
force-pushed
the
fresh-type-changes/memo-comparison
branch
from
July 8, 2026 16:56
2e285a1 to
2f65706
Compare
hoxyq
approved these changes
Jul 8, 2026
|
Comparing: 3b9b59f...2f65706 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
github-actions Bot
pushed a commit
that referenced
this pull request
Jul 8, 2026
…36964) Editing the second argument of memo() previously never took effect until something else remounted the tree, for two separate reasons: - When adding a comparison function, we need to switch from SimpleMemoComponent to MemoComponent so canPreserveStateBetween should return false. - MemoComponent was missing from the hot reload type resolution in createWorkInProgress, so existing fibers kept reading .compare from the old memo object forever. New behavior: - Adding or removing the comparison function remounts; we need to do this when adding (SimpleMemoComponent doesn't support a comparison function) so let's also do it when removing. - Editing the comparison function implementation applies in place with state preserved The TODO in isCompatibleFamilyForHotReloading is removed as that wasn't the right place to do this check. DiffTrain build for [4400d6c](4400d6c)
github-actions Bot
pushed a commit
that referenced
this pull request
Jul 8, 2026
…36964) Editing the second argument of memo() previously never took effect until something else remounted the tree, for two separate reasons: - When adding a comparison function, we need to switch from SimpleMemoComponent to MemoComponent so canPreserveStateBetween should return false. - MemoComponent was missing from the hot reload type resolution in createWorkInProgress, so existing fibers kept reading .compare from the old memo object forever. New behavior: - Adding or removing the comparison function remounts; we need to do this when adding (SimpleMemoComponent doesn't support a comparison function) so let's also do it when removing. - Editing the comparison function implementation applies in place with state preserved The TODO in isCompatibleFamilyForHotReloading is removed as that wasn't the right place to do this check. DiffTrain build for [4400d6c](4400d6c)
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.
Editing the second argument of memo() previously never took effect
until something else remounted the tree, for two separate reasons:
SimpleMemoComponent to MemoComponent so canPreserveStateBetween
should return false.
createWorkInProgress, so existing fibers kept reading .compare from
the old memo object forever.
New behavior:
this when adding (SimpleMemoComponent doesn't support a comparison
function) so let's also do it when removing.
with state preserved
The TODO in isCompatibleFamilyForHotReloading is removed as that
wasn't the right place to do this check.