Skip to content

TabsNav takes a slot count it only uses outside a BuildBridge, which only its tests do #1128

Backlog

Description

@richshaw

What happens

#1077 put a slot count beside the Build tab. The signup layout (src/app/(organizer)/app/(chrome)/signups/[id]/layout.tsx) builds one slots value and passes it twice:

  • To BuildBridge, as the initial count. The bridge keeps it in state, BuildWysiwyg updates it through useReportSlotCount, and it's provided through SlotsContext.
  • To TabsNav, as counts.slots. TabsNav reads useSlotCount() ?? counts.slots.

Inside a BuildBridge, useSlotCount() is never null. The provider's value starts as the required slots prop and is only ever set to another SlotCount. The one production render of TabsNav is in that layout, inside the bridge. The layout's error branches render only SignupLoadError, and there is no error.tsx, loading.tsx or not-found.tsx under src/app/(organizer). So counts.slots and its five-line doc comment are only used by the seven bridge-less renders in TabsNav.test.tsx.

Only developers are affected. The count on screen comes from the bridge either way.

Fix, in outline

  • Drop slots from TabsNav's counts prop and its doc comment. Read the count from useSlotCount() alone.
  • useSlotCount() returns SlotCount | null. Since TabsNav is its only caller, either throw when it's null ("TabsNav must sit inside a BuildBridge") or make the hook throw.
  • In the layout, pass counts={{ responses: responsesCount }}. Keep slots={slots} on BuildBridge. It's the initial value, the only count on the Responses and Settings tabs, and what replaces the Build tab's last report when the layout reloads.
  • Wrap the seven TabsNav.test.tsx renders in <BuildBridge … slots={…}>, as BuildBridge.test.tsx already does (a small render helper keeps it short). Drop counts.slots from the two BuildBridge.test.tsx renders.

Watch for

  • The two { count, spoken } builders stay. One is in the layout (server translator) and one is in BuildWysiwyg (client). Both are needed, and both read the same catalog message, so they can't drift.
  • Overlap. Open PR Fit a signup's three tabs on a 320px phone in every language #1112 changes classes in TabsNav.tsx, so whichever lands second has a small merge.

Done when

  • TabsNav has no counts.slots, and nothing passes it.
  • The TabsNav and BuildBridge tests pass with the tab still showing its count.
  • pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test pass.

Found by the pipeline's refactor scout in the organizer app (src/app/(organizer)/app/(chrome)/signups/[id], src/components/signup), at 09127b0. Checked by an independent verify agent. It grepped every <TabsNav render in src and tests, traced SlotsContext's value, checked the layout's error branches and route files, and ran the 28 TabsNav and BuildBridge tests (pass). https://claude.ai/code/session_016YZ9SUU7gKULMTji6bA6jw

Activity

  1. added
    enhancement
    good first issue
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issuepipeline:ready

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions