Skip to content

fix(web): sidebar thread rows stop re-rendering on server-config changes - #40049

Closed
shivamhwp wants to merge 1 commit into
mainfrom
issue-watch/39934
Closed

shivamhwp wants to merge 1 commit into
mainfrom
issue-watch/39934

Conversation

@shivamhwp

Copy link
Copy Markdown
Collaborator

Refs #39934

Each sidebar thread row called useServerConfigs() through two hooks to read one boolean for its own environment. That subscribed every row to the whole server-config Map, so each config change during startup re-rendered all rows. The two hooks now read per-environment boolean atoms derived from the Map, so a row re-renders only when its own environment's flag changes. Rows still re-render when an environment's config appears or its issues capability changes.

Render count. Row renders attributed to the server-config Map, production web build, 300 threads, headless Chromium, 12 loads per side, run back to back. Two runs per side.

Base (d984b71) This PR
Loads with Map-attributed row renders 6 of 12, then 5 of 12 (600 each) 0 of 12, then 0 of 12

Tests and checks.

  • vp run check:changed against the base commit: format, lint, knip, typecheck, the 3 affected test files, and the React compiler step all pass.
  • New apps/web/src/state/presentation.test.ts ("notifies a row only when its own environment's flag changes"). It fails when the subscription is to the Map itself, which is how the sidebar read it on the base commit.
  • The two browser tests that turned on PR-link support by mocking useServerConfigs now mock useSupportsMultiplePullRequests instead. They pass with the same behaviour.

Not shown:

  • A reduction in long-task time. On this VM the median varied from about 2.1 s to 3.9 s between runs, so these runs can't show one.
  • The Windows timings in the issue. Those were not reproduced here.
  • Row-level rendering for the issue tooltip. ThreadDetailsIssueRows still reads the Map while its hover tooltip is open. It mounts only on hover.

Unproven:

  • The integrated pass in T3's browser tools against the web client (the test-t3-app pass). This change has no visible UI difference. The production build was rendered with 300 threads in Chromium as described above.

Implemented by Claude Opus 5.5 and reviewed by GPT-6.1 Sol, orchestrated by Claude Haiku 5.5 in T3 Code via Claude Code.

🤖 Generated with Claude Code

Each sidebar row called useServerConfigs() through two hooks to read one
boolean for its own environment. That subscribed every row to the whole
server-config Map, so each config change re-rendered all rows during
startup.

The two hooks now read per-environment boolean atoms derived from the Map.
A row only re-renders when its own environment's flag changes. Rows still
re-render when an environment's config appears or its issues capability
changes.

Measured on a production build with 300 threads, headless Chromium, 12
loads per side: the base commit had 600 Map-attributed row renders in 5 of
12 loads; this change has zero in all 12.

Model and harness: implementation by Claude Opus 5.5 and review by GPT-6.1
Sol, orchestrated from Claude Haiku 5.5 in T3 Code via Claude Code.

Co-Authored-By: Claude Haiku 5.5 <[email protected]>
@github-actions github-actions Bot added the vouch:trusted Author is trusted by repo permissions or the VOUCHED list. label Nov 21, 2026
@github-actions github-actions Bot added the size:M 30-99 changed lines (additions + deletions). label Nov 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for 93e8609.

This comment will update automatically after the next completed run.

@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change derives per-environment server-config presence and issue-support flags. Thread and issue state hooks use these flags instead of checking the server-config map. Browser tests mock multiple-pull-request support by environment ID.

Changes: Environment capability flags

Layer / File(s) Summary
Derive per-environment flags
apps/web/src/state/presentation.ts, apps/web/src/state/presentation.test.ts
Adds atoms for server-config presence and issue support per environment. Tests verify their initial values and notifications when configurations change.
Use flags in thread and issue state
apps/web/src/hooks/useSupportsMultiplePullRequests.ts, apps/web/src/state/issues.ts, apps/web/src/components/ThreadStatusIndicators.linkedPr.browser.test.tsx, apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx
The hooks read per-environment flags. When the environment ID is null, useSupportsMultiplePullRequests reads a shared atom initialized to false. Browser tests mock support for the test environment ID.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

Possibly related PRs

  • pingdotgg/t3code#40019 — This PR overlaps in scope and approach: it changes the same hooks to read per-environment boolean atoms.

Suggested labels: bugfix

Suggested reviewers: bil0000, juliusmarminge, macroscopeapp

Merge Risk: Low · up to 93e86

The change reduces sidebar re-renders by using per-environment flags, and nothing in the review shows a defect in it. A web browser test job failed in CI on the thread details panel, and its cause is not yet explained. Confirm that the failure is unrelated or flaky, or re-run it, before merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: sidebar thread rows stop re-rendering on server-config changes. The changeset replaces the whole server-config Map subscription with per-environment boolean atoms, so …
Description check Passed The description follows the template sections: Problem, Change, Scope, and Verification. The Problem and Change sections clearly explain the Map-wide subscription and the per-environment atom fix. The…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: sidebar thread rows stop re-rendering on server-config changes. The changeset replaces the whole server-config Map subscription with per-environment boolean atoms, so each row re-renders only when its own environment's flag changes. The title follows the conventional commit format the template suggests. The 'fix(web)' prefix and 'stop re-rendering' wording match the stated bug fix.

Full details: Description check

Explanation

The description follows the template sections: Problem, Change, Scope, and Verification. The Problem and Change sections clearly explain the Map-wide subscription and the per-environment atom fix. The Scope section links issue #39934 as the bug report. The Verification section gives focused tests, a measured render count before and after, and lists what was not checked. It also names the models used, as the template asks. Scope is only partly covered, since the description does not say why the fix needs no screenshots. The UI-change note is mostly moot because the author states there is no visible UI difference, and the description says so.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between c551404 and 93e8609.

Files selected for processing: 6

  • apps/web/src/components/ThreadStatusIndicators.linkedPr.browser.test.tsx
  • apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx
  • apps/web/src/hooks/useSupportsMultiplePullRequests.ts
  • apps/web/src/state/issues.ts
  • apps/web/src/state/presentation.test.ts
  • apps/web/src/state/presentation.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@juliusmarminge

Copy link
Copy Markdown
Member

Thanks for this. #40019 makes the same change and is the one being kept.

#40019 makes the same per-environment subscription change and also keeps rows without linked issues unsubscribed from issues-capability changes. That additional isolation, covered through the actual React hooks, makes it the more complete version to keep.

Your measurements independently support removing the broad Map subscriptions. They are useful confirmation of the rendering improvement, even though the Windows timing improvement remains unverified here.

Closing as a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants