mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[polyfill] Add sentinel to array
To make the polyfill work well with devtools, we add this sentinel. Devtools will look for this sentinel before adding the Forget badge. ghstack-source-id: d246040f67da48fa46f818753c8bf26dff56f390 Pull Request resolved: https://github.com/facebook/react-forget/pull/2847
This commit is contained in:
@@ -28,6 +28,10 @@ export function unstable_useMemoCache(size: number) {
|
||||
for (let ii = 0; ii < size; ii++) {
|
||||
$[ii] = $empty;
|
||||
}
|
||||
// This symbol is added to tell the react devtools that this array is from
|
||||
// useMemoCache.
|
||||
// @ts-ignore
|
||||
$[$empty] = true;
|
||||
return $;
|
||||
})[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user