Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): keep the no-project action in place while connecting #48016 (GitHub #48015)

OpenWhiteZeek(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/48015/headopened View on GitHub

Problem

Open a new thread while its environment is connecting. The “or start without a project” link appears only after the server reports its scratch folder, pushing the draft headline up by 32 px. The empty-project screen also hides the action during that wait.

Change

Reserve the hint row when rendering the draft. Both screens show the no-project action disabled with a “Connecting…” hint while the target is being resolved. A usable scratch folder enables the action. A connected server that omits the folder hides it. An already usable fallback environment can still start a thread immediately.

Scope

Fixes #47955 in the shared web and desktop renderer.

Verification

  • Ran both versions in Chromium on Windows with the same delayed configuration. The old headline moved 32 px. The fixed headline stayed in place across connecting, ready, and unsupported states. Both screens disabled the action while waiting and hid it for the unsupported server.
  • All 36 focused tests passed, including scratch routing, the draft project picker, and the command palette. vp run check:changed passed. The four changed React files also passed their individual compiler coverage checks.
  • The Linux Electron package from the report was not exercised.
Before connection completes on mainBefore connection completes with this fix
Before: both actions are missingAfter: both actions are visible and disabled

Both actions after connection completes

The recording shows the same configuration arriving in both versions.

https://github.com/user-attachments/assets/fdde6e78-4b52-492c-865e-7ed10a61c108

Implemented with GPT-6.2 Astra (xhigh) in the Codex harness, running in T3 Code.

    1. tanstack-source added labelsbug

    2. Approvability

      Verdict: Approved at 3e5bc19

      Macroscope's review found this PR approvable — The no-project action stays visible with a connecting hint while environments load, reducing layout movement. Existing guards prevent starting without a ready target, and scratch-project operations remain unchanged.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      The scratch-project hook now selects a target environment and reports when selection is pending. The no-project actions use that state to show a connecting label, indicate the pending state, and start a thread only when an environment is available.

      Changes: Scratch target and no-project actions

      Layer / File(s)Summary
      Resolve scratch target state
      apps/web/src/hooks/useScratchProject.ts, apps/web/src/hooks/useScratchProject.test.ts
      The hook adds scratchTarget, which selects a ready environment and reports pending state based on catalog readiness and candidate environments. Tests cover connection phases and environment configuration.
      Render pending no-project actions
      apps/web/src/components/NoProjectsHero.tsx, apps/web/src/components/chat/DraftHeroHeadline.tsx, apps/web/src/components/ui/button.tsx
      Both hero components use the target’s environment ID and pending state to control the no-project action. Pending actions show “Connecting…” and use aria-disabled. Inline button styles now apply a not-allowed cursor and reduced opacity to aria-disabled buttons.

      Estimated code review effort: 3 (Moderate) | ~20 minutes

      Change: Bug fix · Severity of issue fixed: Medium

      Suggested reviewers: chenxin-yan, saphid

      Merge Risk: Minimal · up to 3e5bc

      The no-project action now stays in place while the environment connects and is disabled with a "Connecting…" hint. No concrete merge-blocking risk was established.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title "fix(web): keep the no-project action in place while connecting" matches the main change. The PR reserves the hint row so the no-project action stays visible and disabled with a "Connecting……
      Description checkPassedThe description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section states the bug and the layout shift. The Change section explains the fix and the dis…
      Linked Issues checkPassedIssue #47955 requires that the no-project line not pop in or shift the headline, and that it show disabled or pending while the environment connects. It hides only after a connected server reports no …
      Out of Scope Changes checkPassedAll changed files connect to the #47955 objective. DraftHeroHeadline.tsx and NoProjectsHero.tsx apply the pending and hidden states to the two screens. useScratchProject.ts adds the scratchTarget pe…
      Full details: Title check

      Explanation

      The title "fix(web): keep the no-project action in place while connecting" matches the main change. The PR reserves the hint row so the no-project action stays visible and disabled with a "Connecting…" hint while the target environment connects, which prevents the 32 px layout shift. The title is specific, uses a conventional commit prefix, and names the affected area (web).

      Full details: Description check

      Explanation

      The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section states the bug and the layout shift. The Change section explains the fix and the disabled and hidden states. The Scope section links issue #47955 and says the fix covers the shared web and desktop renderer. The Verification section lists the Chromium-on-Windows manual checks, 36 passing focused tests, and the vp run check:changed run, and it states that the Linux Electron package was not exercised. It includes before/after screenshots and a recording, and it names the model and harness used. The template's comment asks for a conventional commit title and for the change to be explained as a fix for a bug, which the description does.

      Full details: Linked Issues check

      Explanation

      Issue #47955 requires that the no-project line not pop in or shift the headline, and that it show disabled or pending while the environment connects. It hides only after a connected server reports no scratch root.

      At the reviewed head, apps/web/src/components/chat/DraftHeroHeadline.tsx always renders the <p className="mt-2 flex h-6 ..."> row. The former scratchWorkspaceRoot === null ? null gate is gone. While pending is true, the link shows the text "Connecting…" in its tooltip, sets aria-disabled, and startScratch returns false because scratchTargetEnvironmentId is null. The link is hidden only when pending is false and no scratch target exists. The PR summary states the same behavior for NoProjectsHero.tsx, which covers the Start without a project button. The summary says useScratchProject.ts returns pending only while the catalog is not ready or a primary, fallback, or sole environment is connecting, reconnecting, or missing server config. It also says a usable fallback target starts a thread immediately. The test changes in useScratchProject.test.ts cover these states. The PR reports manual Chromium checks and 36 passing focused tests. Those reports are not re-run here, so the result rests on the code and summary evidence.

      Full details: Out of Scope Changes check

      Explanation

      All changed files connect to the #47955 objective. DraftHeroHeadline.tsx and NoProjectsHero.tsx apply the pending and hidden states to the two screens. useScratchProject.ts adds the scratchTarget pending logic that both screens use. button.tsx adds aria-disabled styling so the disabled inline button is visibly disabled. useScratchProject.test.ts covers the new target and pending states. The removed assertion on scratchEnvironmentId(null) follows from the new selection logic. No change was found that is unrelated to the issue. One minor point was not verified: the aria-disabled:opacity-64 class in button.tsx is a non-standard opacity value. This does not affect the scope verdict.

      Finishing Touches

      Generate unit tests (beta)

      • 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 52682d10f93e0f4f1741d14908304dad8f7fd22d and 3e5bc19645d9e7208668b176c4aab8a657b9ed31.

      Files selected for processing: 5

      • apps/web/src/components/NoProjectsHero.tsx
      • apps/web/src/components/chat/DraftHeroHeadline.tsx
      • apps/web/src/components/ui/button.tsx
      • apps/web/src/hooks/useScratchProject.test.ts
      • apps/web/src/hooks/useScratchProject.ts

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

    4. juliusmarminge added labelstakeover:in-progress

    5. juliusmarminge added labelstakeover:needs-julius

    6. juliusmarminge removed labelstakeover:in-progress

Sign in to join this conversation.