Repository navigation
fix(pull-requests): opening a pull request no longer crashes the page - #42
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tsxcalled a state setter on every commit. Their inputs,entriesByStatsKeyandlinkedSelection, get a new identity on each render, because the React Compiler does not memoize the feed values they come from.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 (throughuseEffectEvent) and skips the setter when no batch is missing. The updater still recomputes from the latest state for a real update.linkedSelectionobject. 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 auseEffectEvent.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, projectpnupu/t3code, sort "Largest", state "All"). I counted the page's commits with a temporary effect, which is not in this PR:mainselectedUrlfor #36selectedUrlleaves the URL, 0 idle commitsvp run check:changed: format, typecheck (2 packages), React Compiler and the first knip run pass. Lint reportst3code(no-untranslated-copy)atPullRequestsPage.tsx:1354, which is already onmain(fork copy stays in plain English). The second knip run timed out after 900 s. Because of these two, I committed with--no-verify.PullRequestsPagetest harness.Created with Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code