Skip to content

fix(den-web): preserve hook order through dashboard redirects - #5652

Merged
benjaminshafii merged 3 commits into
devfrom
t3code/9bb05a52
Oct 5, 2026
Merged

benjaminshafii merged 3 commits into
devfrom
t3code/9bb05a52

Conversation

@lrnt

@lrnt lrnt commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

What is this about?

Fix the Den web crash when choosing an organization after sign-in or returning from setup.

Fixes ENG-646.

What problem does it solve?

People could hit a client-side exception during navigation and have to reload to continue.

What was the situation before?

Opening Den with multiple organizations could redirect to the dashboard and crash instead of showing the organization chooser: “Rendered fewer hooks than expected.”

How is this implemented?

  • Call both library hooks before the picker and onboarding early returns in org-dashboard-shell.tsx.
  • Let useLibraryModels disable requests while sidebar content is hidden, without skipping hooks.
  • Add an organization-selection journey covering the sign-in redirect, selection, onboarding completion, and reload persistence. Document-identity checks ensure reloads cannot mask the crash.

What else changed?

  • Replace the removed next lint command with focused ESLint rules-of-hooks enforcement, add its dependencies, and run it in CI.

Release note

Choosing an organization after sign-in and returning from setup no longer crash the Den dashboard.

Evidence

evals/specs/org-selection.e2e.test.ts — before: “Rendered fewer hooks than expected”; after: the chooser opens and selection or setup completion returns to the dashboard without a reload.

OrgDashboardShell called its library hooks after the organization-picker and onboarding early returns. Switching to the picker after the auth redirect skipped hooks from the previous render and caused React error 300.

Keep the hooks unconditional and disable sidebar requests on full-page views. Add an organization-selection regression journey and enforce rules-of-hooks in CI.

Signed-off-by: Laurent De Marez <laurent@demarez.org>
@lrnt
lrnt requested a review from a team October 5, 2026 12:42
@vercel

vercel Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
openwork-app Ready Ready Preview Oct 5, 2026 7:48pm UTC
openwork-den Ready Ready Preview Oct 5, 2026 7:48pm UTC
openwork-diagnostics Ready Ready Preview Oct 5, 2026 7:48pm UTC
openwork-landing Ready Ready Preview, v0 Oct 5, 2026 7:48pm UTC

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

OpenWork evidence

Status Commit Preview Updated
🟡 Updating evidence 6b3b425 View run 2026-10-05 20:08:09 UTC

A preview for this commit is being prepared.

The organization picker uses a cookie-authenticated Better Auth endpoint, but seed.web only supplies a bearer token. Sign in once, seed its cookie alongside its token, and probe that same session's active organization.

Signed-off-by: Laurent De Marez <laurent@demarez.org>
Preserve dev's unused-dependency removals alongside the new ESLint hook-order dependencies in the lockfile.

Signed-off-by: Laurent De Marez <laurent@demarez.org>
@lrnt

lrnt commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

CI is currently blocked by the ongoing GitHub Actions runner-assignment incident: https://stspg.io/c11dc9nb1zdq. Warden and evidence checks both failed to acquire a hosted runner on the initial run and one retry; no code steps ran in those cancelled jobs. The organization-selection regression proof passed on 6b3b425. Deferring further retries until runner availability recovers.

@benjaminshafii
benjaminshafii merged commit b04775e into dev Oct 5, 2026
31 of 43 checks passed

This branch is waiting to be deployed

4 active and 1 waiting deployments
Preview – openwork-app — 6b3b4252 Deployed Oct 5, 2026 by vercel[bot]
Preview – openwork-den — 6b3b4252 Deployed Oct 5, 2026 by vercel[bot]
Preview – openwork-landing — 6b3b4252 Deployed Oct 5, 2026 by vercel[bot]
Preview – openwork-diagnostics — 6b3b4252 Deployed Oct 5, 2026 by vercel[bot]
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.

2 participants