@samitouri / QOS-React-1 / commits / 80d867d1bd

Promote inlineUseMemo to stable (remove flag)

Per title, this feature flag is enabled everywhere and is clearly stable, let's promote to stable and remove the flag to simplify.

Joe Savona committed Oct 5, 2023 at 09:20 UTC 80d867d1bdb061c004db663c5fee1d754ce50db2
3 files changed +2 -18
compiler/apps/playground/components/Editor/index.tsx
-5
@@ -114,7 +114,6 @@ function parsePragma(pragma: string) {
114 let disableAllMemoization = false;
115 let validateRefAccessDuringRender = true;
116 let enableEmitFreeze = null;
117 - let inlineUseMemo = true;
117 let validateHooksUsage = true;
118 let validateFrozenLambdas = true;
119 let assertValidMutableRanges = true;
@@ -137,9 +136,6 @@ function parsePragma(pragma: string) {
136 importSpecifierName: "makeReadOnly",
137 };
138 }
140 - if (pragma.includes("@inlineUseMemo false")) {
141 - inlineUseMemo = false;
142 - }
139 if (pragma.includes("@validateHooksUsage false")) {
140 validateHooksUsage = false;
141 }
@@ -153,7 +149,6 @@ function parsePragma(pragma: string) {
149 return {
150 enableAssumeHooksFollowRulesOfReact,
151 disableAllMemoization,
156 - inlineUseMemo,
152 memoizeJsxElements,
153 validateHooksUsage,
154 validateRefAccessDuringRender,
compiler/packages/babel-plugin-react-forget/src/Entrypoint/Pipeline.ts
+2 -4
@@ -106,10 +106,8 @@ function* runWithEnvironment(
106 pruneMaybeThrows(hir);
107 yield log({ kind: "hir", name: "PruneMaybeThrows", value: hir });
108
109 - if (env.config.inlineUseMemo) {
110 - inlineUseMemo(hir);
111 - yield log({ kind: "hir", name: "RewriteUseMemo", value: hir });
112 - }
109 + inlineUseMemo(hir);
110 + yield log({ kind: "hir", name: "RewriteUseMemo", value: hir });
111
112 mergeConsecutiveBlocks(hir);
113 yield log({ kind: "hir", name: "MergeConsecutiveBlocks", value: hir });
compiler/packages/babel-plugin-react-forget/src/HIR/Environment.ts
-9
@@ -132,14 +132,6 @@ export type EnvironmentConfig = {
132 */
133 validateNoSetStateInRender: boolean;
134
135 - /**
136 - * Enable inlining of `useMemo()` function expressions so that they can be more optimally
137 - * compiled.
138 - *
139 - * Defaults to false
140 - */
141 - inlineUseMemo: boolean;
142 -
135 /**
136 * When enabled, the compiler assumes that hooks follow the Rules of React:
137 * - Hooks may memoize computation based on any of their parameters, thus
@@ -224,7 +216,6 @@ const DEFAULT_ENVIRONMENT_CONFIG: Readonly<EnvironmentConfig> = {
216 customHooks: null,
217
218 memoizeJsxElements: true,
227 - inlineUseMemo: true,
219 validateHooksUsage: true,
220
221 assertValidMutableRanges: false,