Skip to content

Optimize publish repository dialog state#2991

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/component-performance-optimization-b888
Draft

Optimize publish repository dialog state#2991
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/component-performance-optimization-b888

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented Jun 7, 2026

What Changed

  • Removed two effect-driven state sync paths from PublishRepositoryDialog.
  • Derived the active publish provider from provider readiness during render instead of correcting it in an effect.
  • Derived the repository path from the selected provider/account until the user edits it, replacing handler-only state with a nullable user override.
  • Added browser coverage for provider fallback, account prefill, manual repository edits, and provider-switch prefill reset.

Why

React Doctor flagged GitActionsControl.tsx for set-state-in-effect and rerender-state-only-in-handlers in the publish repository dialog. Those effects caused stale renders followed by immediate corrective renders when opening the dialog or when provider readiness changed. Calculating these values during render matches React guidance from "You Might Not Need an Effect" and avoids the extra commits while preserving behavior.

React Doctor final scan for src/components/GitActionsControl.tsx:

  • set-state-in-effect: 2 -> 0
  • rerender-state-only-in-handlers: 1 -> 0

React Scan controlled publish-dialog flow:

  • Before: PublishRepositoryDialog rendered 7 times
  • After: PublishRepositoryDialog rendered 5 times

UI Changes

Before/after React Scan recordings were captured with the React Scan toolbar and rerender overlays enabled:

  • react_scan_publish_dialog_before.mp4
  • react_scan_publish_dialog_after.mp4

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Validation:

  • pnpm --filter @t3tools/web test:browser -- src/components/GitActionsControl.browser.tsx (passes, 152 browser tests)
  • npx -y react-doctor@latest apps/web --verbose --offline --json (targeted findings removed; command still exits nonzero due pre-existing unrelated findings)
  • pnpm exec vp check (passes)
  • pnpm exec vp run typecheck (passes)
Open in Web View Automation 

Note

Derive publish provider and repository state in PublishRepositoryDialog instead of using effects

  • Replaces publishProvider state with requestedPublishProvider plus a derived publishProvider that falls back to the first ready provider, eliminating the effect that previously forced provider selection.
  • Replaces the publishRepository string state and hasUserEditedPublishRepository flag with a nullable publishRepositoryOverride plus a derived publishRepository that coalesces the override with a per-provider account prefill.
  • Switching providers clears publishRepositoryOverride, resetting the input to the new provider's account prefill; user edits persist across wizard steps within the same provider.
  • Adds browser tests in GitActionsControl.browser.tsx covering provider defaulting, repository prefill, persistence of user edits, and reset on provider change.

Macroscope summarized 387afe4.

Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jun 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 7, 2026

🚀 Expo continuous deployment is ready!

  • Project → t3-code
  • Platforms → android, ios
  • Scheme → t3code-preview
  🤖 Android 🍎 iOS
Fingerprint 50af7188c45504c4cf76a4d9ba23a0d6e9b94177 2c1319138333022ef53422fedb7381e34b960fe8
Build Details Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: 50af7188c45504c4cf76a4d9ba23a0d6e9b94177
App version: 0.1.0
Git commit: a8e48c18d1ffba680eb07a58eac0299fa1079125
Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: 2c1319138333022ef53422fedb7381e34b960fe8
App version: 0.1.0
Git commit: a8e48c18d1ffba680eb07a58eac0299fa1079125
Update Details Update Permalink
DetailsBranch: pr-2991
Runtime version: 50af7188c45504c4cf76a4d9ba23a0d6e9b94177
Git commit: a8e48c18d1ffba680eb07a58eac0299fa1079125
Update Permalink
DetailsBranch: pr-2991
Runtime version: 2c1319138333022ef53422fedb7381e34b960fe8
Git commit: a8e48c18d1ffba680eb07a58eac0299fa1079125
Update QR

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 PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant