Repository navigation
Commit dac22e1
perf(react): don't memoize getServerSnapshot in useStore (#3563)
React only calls getServerSnapshot during hydration/server rendering and
never retains or compares its identity (checked across 18.0-19.2, Fizz,
the shim, preact/compat and RN), so the useCallback around it was pure
per-render overhead: one hook slot, a deps array and a closure. Dropping
it saves ~13% of useStore's per-render allocation and a few bytes.
Co-authored-by: Samuel Attard <[email protected]>1 parent d7a5583 commit dac22e1
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
0 commit comments