Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export const EnvironmentConfigSchema = z.object({
* that if a useEffect or useCallback references a function value, that function value will be
* considered frozen, and in turn all of its referenced variables will be considered frozen as well.
*/
enablePreserveExistingMemoizationGuarantees: z.boolean().default(false),
enablePreserveExistingMemoizationGuarantees: z.boolean().default(true),

/**
* Validates that all useMemo/useCallback values are also memoized by Forget. This mode can be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
## Input

```javascript
// @enablePreserveExistingMemoizationGuarantees:false
// bar(props.b) is an allocating expression that produces a primitive, which means
// that Forget should memoize it.
// Correctness:
Expand All @@ -16,7 +17,8 @@ function AllocatingPrimitiveAsDep(props) {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // bar(props.b) is an allocating expression that produces a primitive, which means
import { c as _c } from "react/compiler-runtime"; // @enablePreserveExistingMemoizationGuarantees:false
// bar(props.b) is an allocating expression that produces a primitive, which means
// that Forget should memoize it.
// Correctness:
// - y depends on either bar(props.b) or bar(props.b) + 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @enablePreserveExistingMemoizationGuarantees:false
// bar(props.b) is an allocating expression that produces a primitive, which means
// that Forget should memoize it.
// Correctness:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
## Input

```javascript
// @enablePreserveExistingMemoizationGuarantees:false
import {useMemo} from 'react';

const someGlobal = {value: 0};
Expand Down Expand Up @@ -32,7 +33,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react/compiler-runtime"; // @enablePreserveExistingMemoizationGuarantees:false
import { useMemo } from "react";

const someGlobal = { value: 0 };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @enablePreserveExistingMemoizationGuarantees:false
import {useMemo} from 'react';

const someGlobal = {value: 0};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
## Input

```javascript
// @enablePreserveExistingMemoizationGuarantees:false
function Component(props) {
let a = foo();
// freeze `a` so we know the next line cannot mutate it
Expand All @@ -17,7 +18,7 @@ function Component(props) {
## Code

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react/compiler-runtime"; // @enablePreserveExistingMemoizationGuarantees:false
function Component(props) {
const $ = _c(2);
const a = foo();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @enablePreserveExistingMemoizationGuarantees:false
function Component(props) {
let a = foo();
// freeze `a` so we know the next line cannot mutate it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
## Input

```javascript
// @enablePreserveExistingMemoizationGuarantees:false
import {Stringify, identity} from 'shared-runtime';

function foo() {
Expand Down Expand Up @@ -64,7 +65,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react/compiler-runtime"; // @enablePreserveExistingMemoizationGuarantees:false
import { Stringify, identity } from "shared-runtime";

function foo() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @enablePreserveExistingMemoizationGuarantees:false
import {Stringify, identity} from 'shared-runtime';

function foo() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
## Input

```javascript
// @enablePreserveExistingMemoizationGuarantees:false
import {useMemo} from 'react';
import {Stringify} from 'shared-runtime';

Expand All @@ -25,7 +26,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react/compiler-runtime"; // @enablePreserveExistingMemoizationGuarantees:false
import { useMemo } from "react";
import { Stringify } from "shared-runtime";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @enablePreserveExistingMemoizationGuarantees:false
import {useMemo} from 'react';
import {Stringify} from 'shared-runtime';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
## Input

```javascript
// @enablePreserveExistingMemoizationGuarantees:false
function foo(props) {
let x, y;
({x, y} = {x: props.a, y: props.b});
Expand All @@ -21,6 +22,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
// @enablePreserveExistingMemoizationGuarantees:false
function foo(props) {
let x;
let y;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @enablePreserveExistingMemoizationGuarantees:false
function foo(props) {
let x, y;
({x, y} = {x: props.a, y: props.b});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
// @flow @enableNewMutationAliasingModel
// @flow @enableNewMutationAliasingModel @enablePreserveExistingMemoizationGuarantees:false
/**
* This hook returns a function that when called with an input object,
* will return the result of mapping that input with the supplied map
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @flow @enableNewMutationAliasingModel
// @flow @enableNewMutationAliasingModel @enablePreserveExistingMemoizationGuarantees:false
/**
* This hook returns a function that when called with an input object,
* will return the result of mapping that input with the supplied map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
// @validatePreserveExistingMemoizationGuarantees
// @validatePreserveExistingMemoizationGuarantees @enablePreserveExistingMemoizationGuarantees:false

/**
* Repro from https://github.com/facebook/react/issues/34262
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @validatePreserveExistingMemoizationGuarantees
// @validatePreserveExistingMemoizationGuarantees @enablePreserveExistingMemoizationGuarantees:false

/**
* Repro from https://github.com/facebook/react/issues/34262
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
// @validatePreserveExistingMemoizationGuarantees
// @validatePreserveExistingMemoizationGuarantees @enablePreserveExistingMemoizationGuarantees:false

import {identity, Stringify, useHook} from 'shared-runtime';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @validatePreserveExistingMemoizationGuarantees
// @validatePreserveExistingMemoizationGuarantees @enablePreserveExistingMemoizationGuarantees:false

import {identity, Stringify, useHook} from 'shared-runtime';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
// @flow @validatePreserveExistingMemoizationGuarantees
// @flow @validatePreserveExistingMemoizationGuarantees @enablePreserveExistingMemoizationGuarantees:false
import {useMemo} from 'react';
import {logValue, useFragment, useHook, typedLog} from 'shared-runtime';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @flow @validatePreserveExistingMemoizationGuarantees
// @flow @validatePreserveExistingMemoizationGuarantees @enablePreserveExistingMemoizationGuarantees:false
import {useMemo} from 'react';
import {logValue, useFragment, useHook, typedLog} from 'shared-runtime';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
// @flow @validatePreserveExistingMemoizationGuarantees
// @flow @validatePreserveExistingMemoizationGuarantees @enablePreserveExistingMemoizationGuarantees:false
import {useFragment} from 'react-relay';
import LogEvent from 'LogEvent';
import {useCallback, useMemo} from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @flow @validatePreserveExistingMemoizationGuarantees
// @flow @validatePreserveExistingMemoizationGuarantees @enablePreserveExistingMemoizationGuarantees:false
import {useFragment} from 'react-relay';
import LogEvent from 'LogEvent';
import {useCallback, useMemo} from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
// @validatePreserveExistingMemoizationGuarantees
// @validatePreserveExistingMemoizationGuarantees @enablePreserveExistingMemoizationGuarantees:false
import {useMemo} from 'react';
import {ValidateMemoization, useHook} from 'shared-runtime';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @validatePreserveExistingMemoizationGuarantees
// @validatePreserveExistingMemoizationGuarantees @enablePreserveExistingMemoizationGuarantees:false
import {useMemo} from 'react';
import {ValidateMemoization, useHook} from 'shared-runtime';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
// @validatePreserveExistingMemoizationGuarantees
// @validatePreserveExistingMemoizationGuarantees @enablePreserveExistingMemoizationGuarantees:false
import {makeObject_Primitives, Stringify} from 'shared-runtime';

function Component(props) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @validatePreserveExistingMemoizationGuarantees
// @validatePreserveExistingMemoizationGuarantees @enablePreserveExistingMemoizationGuarantees:false
import {makeObject_Primitives, Stringify} from 'shared-runtime';

function Component(props) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
// @validatePreserveExistingMemoizationGuarantees
// @validatePreserveExistingMemoizationGuarantees @enablePreserveExistingMemoizationGuarantees:false
import {makeObject_Primitives, Stringify} from 'shared-runtime';

function Component(props) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @validatePreserveExistingMemoizationGuarantees
// @validatePreserveExistingMemoizationGuarantees @enablePreserveExistingMemoizationGuarantees:false
import {makeObject_Primitives, Stringify} from 'shared-runtime';

function Component(props) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
## Input

```javascript
// @enablePreserveExistingMemoizationGuarantees:false
import {useMemo, useState} from 'react';
import {ValidateMemoization} from 'shared-runtime';

Expand All @@ -28,7 +29,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c2 } from "react/compiler-runtime";
import { c as _c2 } from "react/compiler-runtime"; // @enablePreserveExistingMemoizationGuarantees:false
import { useMemo, useState } from "react";
import { ValidateMemoization } from "shared-runtime";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @enablePreserveExistingMemoizationGuarantees:false
import {useMemo, useState} from 'react';
import {ValidateMemoization} from 'shared-runtime';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
## Input

```javascript
// @enablePreserveExistingMemoizationGuarantees:false
import fbt from 'fbt';

/**
Expand Down Expand Up @@ -35,7 +36,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react/compiler-runtime"; // @enablePreserveExistingMemoizationGuarantees:false
import fbt from "fbt";

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @enablePreserveExistingMemoizationGuarantees:false
import fbt from 'fbt';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
## Input

```javascript
// @enablePreserveExistingMemoizationGuarantees:false
const {identity, mutate} = require('shared-runtime');

function Component(props) {
Expand All @@ -24,6 +25,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
// @enablePreserveExistingMemoizationGuarantees:false
const { identity, mutate } = require("shared-runtime");

function Component(props) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @enablePreserveExistingMemoizationGuarantees:false
const {identity, mutate} = require('shared-runtime');

function Component(props) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
// @hookPattern:".*\b(use[^$]+)$"
// @hookPattern:".*\b(use[^$]+)$" @enablePreserveExistingMemoizationGuarantees:false

import * as React from 'react';
import {makeArray, useHook} from 'shared-runtime';
Expand Down Expand Up @@ -36,7 +36,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @hookPattern:".*\b(use[^$]+)$"
import { c as _c } from "react/compiler-runtime"; // @hookPattern:".*\b(use[^$]+)$" @enablePreserveExistingMemoizationGuarantees:false

import * as React from "react";
import { makeArray, useHook } from "shared-runtime";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @hookPattern:".*\b(use[^$]+)$"
// @hookPattern:".*\b(use[^$]+)$" @enablePreserveExistingMemoizationGuarantees:false

import * as React from 'react';
import {makeArray, useHook} from 'shared-runtime';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
// @debug
// @debug @enablePreserveExistingMemoizationGuarantees:false
function Component(props) {
const x = makeObject();
const y = delete x[props.value];
Expand All @@ -14,7 +14,7 @@ function Component(props) {
## Code

```javascript
// @debug
// @debug @enablePreserveExistingMemoizationGuarantees:false
function Component(props) {
const x = makeObject();
const y = delete x[props.value];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @debug
// @debug @enablePreserveExistingMemoizationGuarantees:false
function Component(props) {
const x = makeObject();
const y = delete x[props.value];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
## Input

```javascript
// @enablePreserveExistingMemoizationGuarantees:false
function Component(props) {
const x = makeObject();
const y = delete x.value;
Expand All @@ -13,6 +14,7 @@ function Component(props) {
## Code

```javascript
// @enablePreserveExistingMemoizationGuarantees:false
function Component(props) {
const x = makeObject();
const y = delete x.value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @enablePreserveExistingMemoizationGuarantees:false
function Component(props) {
const x = makeObject();
const y = delete x.value;
Expand Down
Loading
Loading