[Fast Refresh] Make edits to a memo comparison function take effect (#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.
S
Sophie Alpert committed
4400d6c802df45407e7303a6f84a8dcfabde84ff
Parent: 3b9b59f
Committed by GitHub <noreply@github.com>
on 7/8/2026, 4:58:35 PM