Skip to content

fix(pull-requests): opening a pull request no longer crashes the page - #42

Merged
pnupu merged 1 commit into
mainfrom
ilkka/pr-open-loop
Nov 25, 2026
Merged

pnupu merged 1 commit into
mainfrom
ilkka/pr-open-loop

Conversation

@pnupu

@pnupu pnupu commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Problem

On the Pull requests page with a size sort ("Largest", "Smallest" or "Ready"), a click on a pull request crashes the page with React error pingdotgg#185 (Maximum update depth exceeded). Release 0.1.11001 has the crash. It blocks the release of #41.

Change

Two effects in PullRequestsPage.tsx called a state setter on every commit. Their inputs, entriesByStatsKey and linkedSelection, get a new identity on each render, because the React Compiler does not memoize the feed values they come from.

  • Eager stats effect. It always called setStatsTargetState. A setter call that keeps the same state still re-renders and commits the page, so the effect ran again. The idle page re-rendered about 200 times a second. The effect now checks the committed state first (through useEffectEvent) and skips the setter when no batch is missing. The updater still recomputes from the latest state for a real update.
  • URL-linked effect. It opened the pull request in the right panel store again for each new linkedSelection object. The store update re-rendered the page and made another new object. The effect is now keyed by the selection's content (JSON.stringify) and opens it through a useEffectEvent.

A click commits synchronously, so either loop then hit React's nested update limit.

Scope

Fork bug fix, found in the released desktop app. It has no issue because it blocks a release that is waiting now.

Verification

Real app (vp run dev, web, project pnupu/t3code, sort "Largest", state "All"). I counted the page's commits with a temporary effect, which is not in this PR:

Check main This PR
Commits on an idle page about 200 a second 0 in 2 s
Click on #31 error pingdotgg#185 panel opens, 6 commits
Click on #31, then #36, then #24 — each opens, 5 or 6 commits, no console errors
Default sort, click on #30 — opens, 5 commits
Close the panel — stays closed
Deep link with selectedUrl for #36 — opens #36, selectedUrl leaves the URL, 0 idle commits

Before: clicking a pull request with the Largest sort shows "Maximum update depth exceeded"

After: the same click opens #31 in the right panel

  • vp run check:changed: format, typecheck (2 packages), React Compiler and the first knip run pass. Lint reports t3code(no-untranslated-copy) at PullRequestsPage.tsx:1354, which is already on main (fork copy stays in plain English). The second knip run timed out after 900 s. Because of these two, I committed with --no-verify.
  • A fresh-context review found no issues.
  • No automated test. The loop needs the whole page with its unstable inputs, and the repository has no PullRequestsPage test harness.

Created with Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

With a size sort ("Largest", "Smallest" or "Ready"), clicking a pull request
threw React error pingdotgg#185 (Maximum update depth exceeded).

Two effects called a state setter on every commit. Their inputs,
`entriesByStatsKey` and `linkedSelection`, get a new identity on each render,
because the React Compiler does not memoize the feed values they come from.

- The eager stats effect always called `setStatsTargetState`. A setter call
  that keeps the same state still re-renders and commits the page, so the
  idle page re-rendered about 200 times a second. It now checks the committed
  state first and skips the setter when no batch is missing.
- The URL-linked effect opened the pull request in the right panel store
  again for each new `linkedSelection` object. The store update re-rendered
  the page and made another new object. The effect is now keyed by the
  selection's content.

A click commits synchronously, so either loop then hit React's nested update
limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pnupu
pnupu merged commit c781b8d into main Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant