diff --git a/compiler/packages/babel-plugin-react-compiler/scripts/jest/makeTransform.ts b/compiler/packages/babel-plugin-react-compiler/scripts/jest/makeTransform.ts index 3ebd28f849ac5..99291c2984321 100644 --- a/compiler/packages/babel-plugin-react-compiler/scripts/jest/makeTransform.ts +++ b/compiler/packages/babel-plugin-react-compiler/scripts/jest/makeTransform.ts @@ -181,6 +181,7 @@ function ReactForgetFunctionTransform() { fn, forgetOptions, 'Other', + 'all_features', '_c', null, null, diff --git a/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Pipeline.ts b/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Pipeline.ts index 0953289c1950e..994aa8f18c114 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Pipeline.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Pipeline.ts @@ -24,6 +24,7 @@ import { pruneUnusedLabelsHIR, } from '../HIR'; import { + CompilerMode, Environment, EnvironmentConfig, ReactFunctionType, @@ -100,6 +101,7 @@ import {outlineJSX} from '../Optimization/OutlineJsx'; import {optimizePropsMethodCalls} from '../Optimization/OptimizePropsMethodCalls'; import {transformFire} from '../Transform'; import {validateNoImpureFunctionsInRender} from '../Validation/ValiateNoImpureFunctionsInRender'; +import {CompilerError} from '..'; export type CompilerPipelineValue = | {kind: 'ast'; name: string; value: CodegenFunction} @@ -113,6 +115,7 @@ function run( >, config: EnvironmentConfig, fnType: ReactFunctionType, + mode: CompilerMode, useMemoCacheIdentifier: string, logger: Logger | null, filename: string | null, @@ -122,6 +125,7 @@ function run( const env = new Environment( func.scope, fnType, + mode, config, contextIdentifiers, logger, @@ -160,10 +164,10 @@ function runWithEnvironment( validateUseMemo(hir); if ( + env.isInferredMemoEnabled && !env.config.enablePreserveExistingManualUseMemo && !env.config.disableMemoizationForDebugging && - !env.config.enableChangeDetectionForDebugging && - !env.config.enableMinimalTransformsForRetry + !env.config.enableChangeDetectionForDebugging ) { dropManualMemoization(hir); log({kind: 'hir', name: 'DropManualMemoization', value: hir}); @@ -196,8 +200,13 @@ function runWithEnvironment( inferTypes(hir); log({kind: 'hir', name: 'InferTypes', value: hir}); - if (env.config.validateHooksUsage) { - validateHooksUsage(hir); + if (env.isInferredMemoEnabled) { + if (env.config.validateHooksUsage) { + validateHooksUsage(hir); + } + if (env.config.validateNoCapitalizedCalls) { + validateNoCapitalizedCalls(hir); + } } if (env.config.enableFire) { @@ -205,10 +214,6 @@ function runWithEnvironment( log({kind: 'hir', name: 'TransformFire', value: hir}); } - if (env.config.validateNoCapitalizedCalls) { - validateNoCapitalizedCalls(hir); - } - if (env.config.lowerContextAccess) { lowerContextAccess(hir, env.config.lowerContextAccess); } @@ -219,7 +224,12 @@ function runWithEnvironment( analyseFunctions(hir); log({kind: 'hir', name: 'AnalyseFunctions', value: hir}); - inferReferenceEffects(hir); + const fnEffectErrors = inferReferenceEffects(hir); + if (env.isInferredMemoEnabled) { + if (fnEffectErrors.length > 0) { + CompilerError.throw(fnEffectErrors[0]); + } + } log({kind: 'hir', name: 'InferReferenceEffects', value: hir}); validateLocalsNotReassignedAfterRender(hir); @@ -239,28 +249,30 @@ function runWithEnvironment( inferMutableRanges(hir); log({kind: 'hir', name: 'InferMutableRanges', value: hir}); - if (env.config.assertValidMutableRanges) { - assertValidMutableRanges(hir); - } + if (env.isInferredMemoEnabled) { + if (env.config.assertValidMutableRanges) { + assertValidMutableRanges(hir); + } - if (env.config.validateRefAccessDuringRender) { - validateNoRefAccessInRender(hir); - } + if (env.config.validateRefAccessDuringRender) { + validateNoRefAccessInRender(hir); + } - if (env.config.validateNoSetStateInRender) { - validateNoSetStateInRender(hir); - } + if (env.config.validateNoSetStateInRender) { + validateNoSetStateInRender(hir); + } - if (env.config.validateNoSetStateInPassiveEffects) { - validateNoSetStateInPassiveEffects(hir); - } + if (env.config.validateNoSetStateInPassiveEffects) { + validateNoSetStateInPassiveEffects(hir); + } - if (env.config.validateNoJSXInTryStatements) { - validateNoJSXInTryStatement(hir); - } + if (env.config.validateNoJSXInTryStatements) { + validateNoJSXInTryStatement(hir); + } - if (env.config.validateNoImpureFunctionsInRender) { - validateNoImpureFunctionsInRender(hir); + if (env.config.validateNoImpureFunctionsInRender) { + validateNoImpureFunctionsInRender(hir); + } } inferReactivePlaces(hir); @@ -280,7 +292,12 @@ function runWithEnvironment( value: hir, }); - if (!env.config.enableMinimalTransformsForRetry) { + if (env.isInferredMemoEnabled) { + /** + * Only create reactive scopes (which directly map to generated memo blocks) + * if inferred memoization is enabled. This makes all later passes which + * transform reactive-scope labeled instructions no-ops. + */ inferReactiveScopeVariables(hir); log({kind: 'hir', name: 'InferReactiveScopeVariables', value: hir}); } @@ -529,6 +546,7 @@ export function compileFn( >, config: EnvironmentConfig, fnType: ReactFunctionType, + mode: CompilerMode, useMemoCacheIdentifier: string, logger: Logger | null, filename: string | null, @@ -538,6 +556,7 @@ export function compileFn( func, config, fnType, + mode, useMemoCacheIdentifier, logger, filename, diff --git a/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts b/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts index 34c1af955b3cc..0865b50f84116 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts @@ -16,7 +16,6 @@ import { EnvironmentConfig, ExternalFunction, ReactFunctionType, - MINIMAL_RETRY_CONFIG, } from '../HIR/Environment'; import {CodegenFunction} from '../ReactiveScopes'; import {isComponentDeclaration} from '../Utils/ComponentDeclaration'; @@ -407,6 +406,7 @@ export function compileProgram( fn, environment, fnType, + 'all_features', useMemoCacheIdentifier.name, pass.opts.logger, pass.filename, @@ -417,18 +417,29 @@ export function compileProgram( compileResult = {kind: 'error', error: err}; } } - // If non-memoization features are enabled, retry regardless of error kind - if (compileResult.kind === 'error' && environment.enableFire) { + + if (compileResult.kind === 'error') { + /** + * If an opt out directive is present, log only instead of throwing and don't mark as + * containing a critical error. + */ + if (optOutDirectives.length > 0) { + logError(compileResult.error, pass, fn.node.loc ?? null); + } else { + handleError(compileResult.error, pass, fn.node.loc ?? null); + } + // If non-memoization features are enabled, retry regardless of error kind + if (!environment.enableFire) { + return null; + } try { compileResult = { kind: 'compile', compiledFn: compileFn( fn, - { - ...environment, - ...MINIMAL_RETRY_CONFIG, - }, + environment, fnType, + 'no_inferred_memo', useMemoCacheIdentifier.name, pass.opts.logger, pass.filename, @@ -436,20 +447,9 @@ export function compileProgram( ), }; } catch (err) { - compileResult = {kind: 'error', error: err}; - } - } - if (compileResult.kind === 'error') { - /** - * If an opt out directive is present, log only instead of throwing and don't mark as - * containing a critical error. - */ - if (optOutDirectives.length > 0) { - logError(compileResult.error, pass, fn.node.loc ?? null); - } else { - handleError(compileResult.error, pass, fn.node.loc ?? null); + // TODO: we might want to log error here, but this will also result in duplicate logging + return null; } - return null; } pass.opts.logger?.logEvent(pass.filename, { diff --git a/compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts b/compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts index 785240653e0d3..4fce273b7a2de 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts @@ -96,6 +96,8 @@ export const MacroSchema = z.union([ z.tuple([z.string(), z.array(MacroMethodSchema)]), ]); +export type CompilerMode = 'all_features' | 'no_inferred_memo'; + export type Macro = z.infer; export type MacroMethod = z.infer; @@ -550,8 +552,6 @@ const EnvironmentConfigSchema = z.object({ */ disableMemoizationForDebugging: z.boolean().default(false), - enableMinimalTransformsForRetry: z.boolean().default(false), - /** * When true, rather using memoized values, the compiler will always re-compute * values, and then use a heuristic to compare the memoized value to the newly @@ -626,17 +626,6 @@ const EnvironmentConfigSchema = z.object({ export type EnvironmentConfig = z.infer; -export const MINIMAL_RETRY_CONFIG: PartialEnvironmentConfig = { - validateHooksUsage: false, - validateRefAccessDuringRender: false, - validateNoSetStateInRender: false, - validateNoSetStateInPassiveEffects: false, - validateNoJSXInTryStatements: false, - validateMemoizedEffectDependencies: false, - validateNoCapitalizedCalls: null, - validateBlocklistedImports: null, - enableMinimalTransformsForRetry: true, -}; /** * For test fixtures and playground only. * @@ -851,6 +840,7 @@ export class Environment { code: string | null; config: EnvironmentConfig; fnType: ReactFunctionType; + compilerMode: CompilerMode; useMemoCacheIdentifier: string; hasLoweredContextAccess: boolean; hasFireRewrite: boolean; @@ -861,6 +851,7 @@ export class Environment { constructor( scope: BabelScope, fnType: ReactFunctionType, + compilerMode: CompilerMode, config: EnvironmentConfig, contextIdentifiers: Set, logger: Logger | null, @@ -870,6 +861,7 @@ export class Environment { ) { this.#scope = scope; this.fnType = fnType; + this.compilerMode = compilerMode; this.config = config; this.filename = filename; this.code = code; @@ -924,6 +916,10 @@ export class Environment { this.#hoistedIdentifiers = new Set(); } + get isInferredMemoEnabled(): boolean { + return this.compilerMode !== 'no_inferred_memo'; + } + get nextIdentifierId(): IdentifierId { return makeIdentifierId(this.#nextIdentifer++); } diff --git a/compiler/packages/babel-plugin-react-compiler/src/Inference/InferFunctionEffects.ts b/compiler/packages/babel-plugin-react-compiler/src/Inference/InferFunctionEffects.ts index fe209924e4e08..a58ae440219b9 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Inference/InferFunctionEffects.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Inference/InferFunctionEffects.ts @@ -5,7 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -import {CompilerError, ErrorSeverity, ValueKind} from '..'; +import { + CompilerError, + CompilerErrorDetailOptions, + ErrorSeverity, + ValueKind, +} from '..'; import { AbstractValue, BasicBlock, @@ -290,21 +295,21 @@ export function inferTerminalFunctionEffects( return functionEffects; } -export function raiseFunctionEffectErrors( +export function transformFunctionEffectErrors( functionEffects: Array, -): void { - functionEffects.forEach(eff => { +): Array { + return functionEffects.map(eff => { switch (eff.kind) { case 'ReactMutation': case 'GlobalMutation': { - CompilerError.throw(eff.error); + return eff.error; } case 'ContextMutation': { - CompilerError.throw({ + return { severity: ErrorSeverity.Invariant, reason: `Unexpected ContextMutation in top-level function effects`, loc: eff.loc, - }); + }; } default: assertExhaustive( diff --git a/compiler/packages/babel-plugin-react-compiler/src/Inference/InferReferenceEffects.ts b/compiler/packages/babel-plugin-react-compiler/src/Inference/InferReferenceEffects.ts index bfa0825408355..ae71da64b4191 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Inference/InferReferenceEffects.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Inference/InferReferenceEffects.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {CompilerError} from '../CompilerError'; +import {CompilerError, CompilerErrorDetailOptions} from '../CompilerError'; import {Environment} from '../HIR'; import { AbstractValue, @@ -49,7 +49,7 @@ import {assertExhaustive} from '../Utils/utils'; import { inferTerminalFunctionEffects, inferInstructionFunctionEffects, - raiseFunctionEffectErrors, + transformFunctionEffectErrors, } from './InferFunctionEffects'; const UndefinedValue: InstructionValue = { @@ -103,7 +103,7 @@ const UndefinedValue: InstructionValue = { export default function inferReferenceEffects( fn: HIRFunction, options: {isFunctionExpression: boolean} = {isFunctionExpression: false}, -): void { +): Array { /* * Initial state contains function params * TODO: include module declarations here as well @@ -241,8 +241,9 @@ export default function inferReferenceEffects( if (options.isFunctionExpression) { fn.effects = functionEffects; - } else if (!fn.env.config.enableMinimalTransformsForRetry) { - raiseFunctionEffectErrors(functionEffects); + return []; + } else { + return transformFunctionEffectErrors(functionEffects); } } diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-capitalized-fn-call.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-capitalized-fn-call.expect.md index f7f413dedf906..77bdd312751e3 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-capitalized-fn-call.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-capitalized-fn-call.expect.md @@ -2,7 +2,7 @@ ## Input ```javascript -// @validateNoCapitalizedCalls @enableFire +// @validateNoCapitalizedCalls @enableFire @panicThreshold(none) import {fire} from 'react'; const CapitalizedCall = require('shared-runtime').sum; @@ -24,7 +24,7 @@ function Component({prop1, bar}) { ## Code ```javascript -import { useFire } from "react/compiler-runtime"; // @validateNoCapitalizedCalls @enableFire +import { useFire } from "react/compiler-runtime"; // @validateNoCapitalizedCalls @enableFire @panicThreshold(none) import { fire } from "react"; const CapitalizedCall = require("shared-runtime").sum; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-capitalized-fn-call.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-capitalized-fn-call.js index b872fd8670e8e..679945eaab54f 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-capitalized-fn-call.js +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-capitalized-fn-call.js @@ -1,4 +1,4 @@ -// @validateNoCapitalizedCalls @enableFire +// @validateNoCapitalizedCalls @enableFire @panicThreshold(none) import {fire} from 'react'; const CapitalizedCall = require('shared-runtime').sum; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-eslint-suppressions.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-eslint-suppressions.expect.md index ad7f0ab467b00..30bd6d42e50a9 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-eslint-suppressions.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-eslint-suppressions.expect.md @@ -2,7 +2,7 @@ ## Input ```javascript -// @enableFire +// @enableFire @panicThreshold(none) import {useRef} from 'react'; function Component({props, bar}) { @@ -26,7 +26,7 @@ function Component({props, bar}) { ## Code ```javascript -import { useFire } from "react/compiler-runtime"; // @enableFire +import { useFire } from "react/compiler-runtime"; // @enableFire @panicThreshold(none) import { useRef } from "react"; function Component(t0) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-eslint-suppressions.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-eslint-suppressions.js index 7145fef03b1d4..5312e5707cc1f 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-eslint-suppressions.js +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-eslint-suppressions.js @@ -1,4 +1,4 @@ -// @enableFire +// @enableFire @panicThreshold(none) import {useRef} from 'react'; function Component({props, bar}) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-preserve-memo.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-preserve-memo.expect.md index 9f8db6265f064..6477a011264bd 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-preserve-memo.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-preserve-memo.expect.md @@ -2,7 +2,7 @@ ## Input ```javascript -// @validatePreserveExistingMemoizationGuarantees @enableFire +// @validatePreserveExistingMemoizationGuarantees @enableFire @panicThreshold(none) import {fire} from 'react'; import {sum} from 'shared-runtime'; @@ -24,7 +24,7 @@ function Component({prop1, bar}) { ## Code ```javascript -import { useFire } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableFire +import { useFire } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableFire @panicThreshold(none) import { fire } from "react"; import { sum } from "shared-runtime"; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-preserve-memo.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-preserve-memo.js index b7c01e40ac2a5..c3bb8b4216438 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-preserve-memo.js +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-preserve-memo.js @@ -1,4 +1,4 @@ -// @validatePreserveExistingMemoizationGuarantees @enableFire +// @validatePreserveExistingMemoizationGuarantees @enableFire @panicThreshold(none) import {fire} from 'react'; import {sum} from 'shared-runtime'; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-prop-write.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-prop-write.expect.md index 74d9f679c4ffd..e6ce051f10aad 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-prop-write.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-prop-write.expect.md @@ -2,7 +2,7 @@ ## Input ```javascript -// @enableFire +// @enableFire @panicThreshold(none) import {fire} from 'react'; function Component({prop1}) { @@ -20,7 +20,7 @@ function Component({prop1}) { ## Code ```javascript -import { useFire } from "react/compiler-runtime"; // @enableFire +import { useFire } from "react/compiler-runtime"; // @enableFire @panicThreshold(none) import { fire } from "react"; function Component(t0) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-prop-write.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-prop-write.js index 4fac46f78e81c..b0cfd4fe39fc8 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-prop-write.js +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-prop-write.js @@ -1,4 +1,4 @@ -// @enableFire +// @enableFire @panicThreshold(none) import {fire} from 'react'; function Component({prop1}) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-ref-current-access.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-ref-current-access.expect.md index af0fc7b5a2f26..79f5a2986d119 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-ref-current-access.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-ref-current-access.expect.md @@ -2,7 +2,7 @@ ## Input ```javascript -// @flow @enableFire +// @flow @enableFire @panicThreshold(none) import {fire} from 'react'; import {print} from 'shared-runtime'; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-ref-current-access.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-ref-current-access.js index 96ccf0b161e93..f649fe5902362 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-ref-current-access.js +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-retry/bailout-validate-ref-current-access.js @@ -1,4 +1,4 @@ -// @flow @enableFire +// @flow @enableFire @panicThreshold(none) import {fire} from 'react'; import {print} from 'shared-runtime'; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-validate-conditional-hook.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-validate-conditional-hook.expect.md index c20f89d3af8d2..dde2b692f40f7 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-validate-conditional-hook.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-validate-conditional-hook.expect.md @@ -2,7 +2,7 @@ ## Input ```javascript -// @enableFire +// @enableFire @panicThreshold(none) import {fire, useEffect} from 'react'; import {Stringify} from 'shared-runtime'; @@ -29,7 +29,7 @@ function Component(props) { ## Code ```javascript -import { useFire } from "react/compiler-runtime"; // @enableFire +import { useFire } from "react/compiler-runtime"; // @enableFire @panicThreshold(none) import { fire, useEffect } from "react"; import { Stringify } from "shared-runtime"; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-validate-conditional-hook.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-validate-conditional-hook.js index 0a29fd852c030..fa8c034bfb289 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-validate-conditional-hook.js +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/bailout-validate-conditional-hook.js @@ -1,4 +1,4 @@ -// @enableFire +// @enableFire @panicThreshold(none) import {fire, useEffect} from 'react'; import {Stringify} from 'shared-runtime';