Files
react/packages/react-refresh
dan 7e8a06cf4c [Fresh] Always reset useMemoCache on Fast Refresh (#30700)
Stacked on https://github.com/facebook/react/pull/30662.

Alternative to https://github.com/facebook/react/pull/30663 and
https://github.com/facebook/react/pull/30677.

During a Fast Refresh, we always want to evict the memo cache, same as
we do with normal `useMemo`. The mechanism used by `useMemo` and other
Hooks is this module-level variable:


fca5d655d7/packages/react-reconciler/src/ReactFiberHooks.js (L304-L307)

which has DEV-only behavior as if the dependencies are always different:


fca5d655d7/packages/react-reconciler/src/ReactFiberHooks.js (L451-L460)

The `useMemoCache` Hook doesn't use a dependency array but conceptually
I think we want the same behavior.

## Test Plan

The test passes.

---------

Co-authored-by: Lauren Tan <poteto@users.noreply.github.com>
2024-08-15 01:02:29 +01:00
..
2024-04-17 11:15:27 -07:00
2020-04-30 15:43:21 +01:00

react-refresh

This package implements the wiring necessary to integrate Fast Refresh into bundlers. Fast Refresh is a feature that lets you edit React components in a running application without losing their state. It is similar to an old feature known as "hot reloading", but Fast Refresh is more reliable and officially supported by React.

This package is primarily aimed at developers of bundler plugins. If youre working on one, here is a rough guide for Fast Refresh integration using this package.