Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
[Compiler Bug]: Inconsistent memoization strategy for object with method shorthand vs function properties | GoodFirstPicks

[Compiler Bug]: Inconsistent memoization strategy for object with method shorthand vs function properties

facebook/react 1 comments 4d ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeTest focusedReactJavaScriptTypeScript

Why this is a good first issue

The issue involves understanding and fixing inconsistent memoization strategies in the React Compiler.

AI Summary

The React Compiler generates different memoization strategies for objects with method shorthand versus function properties, leading to inconsistent behavior. The task involves identifying the root cause and ensuring consistent memoization. This requires understanding compiler internals and memoization logic.

Issue Description

What kind of issue is this?

  • React Compiler core (the JS output is incorrect, or your app works incorrectly after optimization)
  • babel-plugin-react-compiler (build issue installing or using the Babel plugin)
  • eslint-plugin-react-hooks (build issue installing or using the eslint plugin)
  • react-compiler-healthcheck (build issue installing or using the healthcheck script)

Link to repro

https://playground.react.dev/#N4Igzg9grgTgxgUxALhAgHgBwjALgAgDMoA7OXASwhPyjAQCEoBzACgEp9gAdG-OamALB89XADkIAEwRgANKIS4AolOaz8AX3wBeWvQCC6krgPkqJMBwDcvfPhhLYNHn3sBbBO4gUAXgik5O3t8XFlcAEYOLmCQxQlpWVZHSAAbADcEAGEIVNSKMAswdls3LSCysKEAJmjXOPsxVXUrFNzMnLyCopLY8r6q3ABmVgB9BRJEznqGgUtchAA6VIg2Nozs3PzCwV6yzQr7TV5jkhA5EDnCCmYUEAp3bDxQgE9MBC58AAVUlgoSADymEogi0RBgEHc+AA5AAjACGsIQqQAtJhfsx-ijHPDyCiBI8KKkEDAAPRSAq4aGlXisGak0kEzBE+EgkgAWUSyHw3BA8LyvJOolZBWuGh+f0BwJ61nO4AAFhAAO4ASRMJJI-LAKEIWoQmiAA

Repro steps

React Compiler generates different memoization strategies depending on whether functions in a returned object are defined using method shorthand or function/arrow properties.

In some cases, the compiler memoizes individual functions and reconstructs the object, while in others it memoizes the entire object directly.

Input

export function useBug() {
  const { setNodes, setEdges } = useAgentActions();
  return {
    memoized,
    test1() {
      setNodes(resolveCollisions);
    },
    test2() {
      setEdges(resolveCollisions);
    },
    test3(_, node) {
      console.log(resolveCollisions);
    },
  };
}

Compiled output

import { c as _c } from "react/compiler-runtime";
export function useBug() {
  const $ = _c(3);
  const { setNodes, setEdges } = useAgentActions();
  let t0;
  if ($[0] !== setEdges || $[1] !== setNodes) {
    t0 = {
      memoized,
      test1() { // recreated when cached object is rebuilt
        setNodes(resolveCollisions);
      },
      test2() { // recreated when cached object is rebuilt
        setEdges(resolveC

GitHub Labels

Type: BugStatus: Unconfirmed

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!

Risk Flags

  • compiler internals
  • memoization strategy
Loading labels...

Details

Points20 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedyes