mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Remove hasForgetMutatedOriginalSource
Derive it from compiledFns rather than duplicating state
This commit is contained in:
@@ -242,7 +242,6 @@ export function compileProgram(
|
||||
// have already encountered errors) for reporting.
|
||||
const lintError = findEslintSuppressions(pass.comments);
|
||||
let hasCriticalError = lintError != null;
|
||||
let hasForgetMutatedOriginalSource: boolean = false;
|
||||
const compiledFns: CompileResult[] = [];
|
||||
|
||||
const traverseFunction = (
|
||||
@@ -359,11 +358,10 @@ export function compileProgram(
|
||||
// error elsewhere in the file, regardless of bailout mode.
|
||||
for (const { originalFn: fn, compiledFn } of compiledFns) {
|
||||
insertNewFunctionDeclaration(fn, compiledFn, pass);
|
||||
hasForgetMutatedOriginalSource = true;
|
||||
}
|
||||
|
||||
// Forget compiled the component, we need to update existing imports of unstable_useMemoCache
|
||||
if (hasForgetMutatedOriginalSource) {
|
||||
if (compiledFns.length > 0) {
|
||||
updateUseMemoCacheImport(program, options);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user