Skip to content

Commit 8c1b357

Browse files
committed
[compiler][playground] Make change detection work in playground
Summary: The change detection mode was unavailable in the playground because the pragma was not a boolean. This fixes that by special casing it in pragma parsing, similar to validateNoCapitalizedCalls [ghstack-poisoned]
1 parent 55fdcf8 commit 8c1b357

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,17 @@ export function parseConfigPragma(pragma: string): EnvironmentConfig {
410410
continue;
411411
}
412412

413+
if (
414+
key === "enableChangeDetectionForDebugging" &&
415+
(val === undefined || val === "true")
416+
) {
417+
maybeConfig[key] = {
418+
source: "react-compiler-runtime",
419+
importSpecifierName: "$structuralCheck",
420+
};
421+
continue;
422+
}
423+
413424
if (typeof defaultConfig[key as keyof EnvironmentConfig] !== "boolean") {
414425
// skip parsing non-boolean properties
415426
continue;

0 commit comments

Comments
 (0)