Skip to content

Commit b16b768

Browse files
authored
[compiler] Feature flag cleanup (facebook#35825)
Cleans up feature flags that do not have an active experiment and which we don't currently plan to ship, one commit per flag. Notable removals: * Automatic (inferred) effect dependencies / Fire: abandoned due to early feedback. Shipped useEffectEvent which addresses some of the use-cases. * Inline JSX transform (experimented, not a consistent win) * Context selectors (experimented, not a sufficient/consistent win given the benefit the compiler already provides) * Instruction Reordering (will try a different approach) To decide which features to remove, I looked at Meta's internal repos as well as eslint-pugin-react-hooks to see which flags were never overridden anywhere. That gave a longer list of flags, from which I then removed some features that I know are used in OSS.
1 parent 2ba3065 commit b16b768

File tree

310 files changed

+88
-15255
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

310 files changed

+88
-15255
lines changed

compiler/CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,12 @@ const UseEffectEventHook = addHook(
215215
Feature flags are configured in `src/HIR/Environment.ts`, for example `enableJsxOutlining`. Test fixtures can override the active feature flags used for that fixture via a comment pragma on the first line of the fixture input, for example:
216216

217217
```javascript
218-
// enableJsxOutlining @enableChangeVariableCodegen:false
218+
// enableJsxOutlining @enableNameAnonymousFunctions:false
219219

220220
...code...
221221
```
222222

223-
Would enable the `enableJsxOutlining` feature and disable the `enableChangeVariableCodegen` feature.
223+
Would enable the `enableJsxOutlining` feature and disable the `enableNameAnonymousFunctions` feature.
224224

225225
## Debugging Tips
226226

compiler/apps/playground/__tests__/e2e/__snapshots__/page.spec.ts/disableMemoizationForDebugging-output.txt

Lines changed: 0 additions & 14 deletions
This file was deleted.

compiler/apps/playground/__tests__/e2e/page.spec.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -283,37 +283,6 @@ test('error is displayed when config has validation error', async ({page}) => {
283283
expect(output.replace(/\s+/g, ' ')).toContain('Unexpected compilationMode');
284284
});
285285

286-
test('disableMemoizationForDebugging flag works as expected', async ({
287-
page,
288-
}) => {
289-
const store: Store = {
290-
source: TEST_SOURCE,
291-
config: `import type { PluginOptions } from 'babel-plugin-react-compiler/dist';
292-
293-
({
294-
environment: {
295-
disableMemoizationForDebugging: true
296-
}
297-
} satisfies PluginOptions);`,
298-
showInternals: false,
299-
};
300-
const hash = encodeStore(store);
301-
await page.goto(`/#${hash}`, {waitUntil: 'networkidle'});
302-
await page.waitForFunction(isMonacoLoaded);
303-
await expandConfigs(page);
304-
await page.screenshot({
305-
fullPage: true,
306-
path: 'test-results/07-config-disableMemoizationForDebugging-flag.png',
307-
});
308-
309-
const text =
310-
(await page.locator('.monaco-editor-output').allInnerTexts()) ?? [];
311-
const output = await formatPrint(text);
312-
313-
expect(output).not.toEqual('');
314-
expect(output).toMatchSnapshot('disableMemoizationForDebugging-output.txt');
315-
});
316-
317286
test('error is displayed when source has syntax error', async ({page}) => {
318287
const syntaxErrorSource = `function TestComponent(props) {
319288
const oops = props.

compiler/packages/babel-plugin-react-compiler/docs/passes/06-inferTypes.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ The `occursCheck` method prevents infinite types by detecting when a type variab
7070
- `DeclareContext` and `LoadContext` generate no type equations (intentionally untyped)
7171
- `StoreContext` with `Const` kind does propagate the rvalue type to enable ref inference through context variables
7272

73-
### Event Handler Inference
74-
When `enableInferEventHandlers` is enabled, JSX props starting with "on" (e.g., `onClick`) on built-in DOM elements (excluding web components with hyphens) are inferred as `Function<BuiltInEventHandlerId>`.
75-
7673
## TODOs
7774
1. **Hook vs Function type ambiguity**:
7875
> "TODO: callee could be a hook or a function, so this type equation isn't correct. We should change Hook to a subtype of Function or change unifier logic."

compiler/packages/babel-plugin-react-compiler/docs/passes/31-codegenReactiveFunction.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,6 @@ if ($[0] !== "source_hash_abc123") {
205205
}
206206
```
207207

208-
### Change Detection for Debugging
209-
When `enableChangeDetectionForDebugging` is configured, additional code is generated to detect when cached values unexpectedly change.
210208

211209
### Labeled Breaks
212210
Control flow with labeled breaks (for early returns or loop exits) uses `codegenLabel` to generate consistent label names:
@@ -231,7 +229,6 @@ type CodegenFunction = {
231229
prunedMemoBlocks: number; // Scopes that were pruned
232230
prunedMemoValues: number; // Values in pruned scopes
233231
hasInferredEffect: boolean;
234-
hasFireRewrite: boolean;
235232
};
236233
```
237234

compiler/packages/babel-plugin-react-compiler/docs/passes/32-transformFire.md

Lines changed: 0 additions & 203 deletions
This file was deleted.

0 commit comments

Comments
 (0)