Skip to content

Commit

Permalink
[compiler][playground] Make change detection work in playground
Browse files Browse the repository at this point in the history
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-source-id: 4a8c17d21ab8b7936ca61c9dd1f7fdf8322614c9
Pull Request resolved: #29889
  • Loading branch information
mvitousek committed Jun 13, 2024
1 parent dfd3097 commit 2ba462b
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,17 @@ export function parseConfigPragma(pragma: string): EnvironmentConfig {
continue;
}

if (
key === "enableChangeDetectionForDebugging" &&
(val === undefined || val === "true")
) {
maybeConfig[key] = {
source: "react-compiler-runtime",
importSpecifierName: "$structuralCheck",
};
continue;
}

if (typeof defaultConfig[key as keyof EnvironmentConfig] !== "boolean") {
// skip parsing non-boolean properties
continue;
Expand Down

0 comments on commit 2ba462b

Please sign in to comment.