Skip to content

Commit

Permalink
exhaust cases when creating stack frame cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Silbermann committed Feb 13, 2024
1 parent b5931a8 commit 976479f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/react-debug-tools/src/ReactDebugHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ function getPrimitiveStackCache(): Map<string, Array<any>> {
if (typeof Dispatcher.useFormState === 'function') {
// This type check is for Flow only.
Dispatcher.useFormState((s: mixed, p: mixed) => s, null);
try {
Dispatcher.useFormState(
(s: mixed, p: mixed) => s,
// This isn't actually a valid call.
// We just simulate a pending promise here to exhaust all cases in the stackframe cache.
({
then() {},
}: any),
);
} catch (x) {}
}
if (typeof Dispatcher.use === 'function') {
// This type check is for Flow only.
Expand Down

0 comments on commit 976479f

Please sign in to comment.