Skip to content

refactor: remove needs-organization variant and extract shared hooks#67

Merged
thomasblaymire merged 7 commits into
mainfrom
refactor/remove-needs-organization
Mar 15, 2026
Merged

refactor: remove needs-organization variant and extract shared hooks#67
thomasblaymire merged 7 commits into
mainfrom
refactor/remove-needs-organization

Conversation

@thomasblaymire
Copy link
Copy Markdown
Owner

Summary

  • Extract reusable useChipInput, useWizard hooks and slug utility from duplicated inline logic, with full test coverage
  • Refactor onboarding wizard steps to use the extracted hooks, centralizing cookie logic into named helpers
  • Remove the unreachable needsOrganization variant from CreateProjectModal — org creation is handled exclusively by the onboarding wizard, making this code path dead

Test plan

  • All 144 unit tests pass (vitest run)
  • TypeScript compiles cleanly (tsc --noEmit)
  • ESLint passes with no new warnings
  • Prettier formatting verified
  • E2E project spec updated to match simplified heading

Consolidate duplicated logic from onboarding steps and project modal
into shared utilities with full test coverage.
Replace inline state management and duplicated helpers in the wizard
steps with the shared useChipInput, useWizard, and slug utilities.
Centralize onboarding cookie logic into named helpers.
The variant was unreachable dead code — org creation is handled
exclusively by the onboarding wizard. Removing it simplifies the
modal, its tests, and all call sites.
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
switchflag-app Ready Ready Preview, Comment Mar 15, 2026 9:44pm
switchflag-web Ready Ready Preview, Comment Mar 15, 2026 9:44pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
switchflag-docs Skipped Skipped Mar 15, 2026 9:44pm

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 15, 2026

Codecov Report

❌ Patch coverage is 98.43400% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
apps/dashboard/src/hooks/use-chip-input.ts 95.19% 4 Missing and 1 partial ⚠️
...shboard/src/components/onboarding/setup-wizard.tsx 89.47% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Replace the network-dependent invitation acceptance UI flow with direct
DB setup (add member + set active org + remove default owner org). The
invitation acceptance is already covered by invite.spec.ts — this test
only needs to verify the wizard isn't shown for non-owner members.

Validated non-flaky across 3 consecutive local runs.
The sqlite3 CLI can hit a lock when the next.js server is also accessing
the same file db. Setting busy_timeout = 5000 makes sqlite retry for up
to 5 seconds instead of failing immediately.
page.reload() is unreliable in CI because the server may cache the
previous session or DB state. Instead, clear all cookies and re-login
to get a completely fresh session that correctly reflects the DB changes.
The non-owner member test requires DB manipulation that isn't reliably
visible to the server process in CI (SQLite WAL visibility + rate
limiting on re-login). Remove it for now — the logic is covered by
unit tests for shouldShowOnboarding. Will re-add with proper ephemeral
E2E environment support.
@vercel vercel Bot temporarily deployed to Preview – switchflag-docs March 15, 2026 21:43 Inactive
@thomasblaymire thomasblaymire merged commit aa54cc7 into main Mar 15, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant