fix: root redirect should prefer personal workspace (#152)#157
Merged
zacharias-ona merged 1 commit intomainfrom Apr 17, 2026
Merged
fix: root redirect should prefer personal workspace (#152)#157zacharias-ona merged 1 commit intomainfrom
zacharias-ona merged 1 commit intomainfrom
Conversation
Co-authored-by: Ona <no-reply@ona.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Collaborator
Author
|
✅ UI verification skipped — no visual changes detected. This PR only modifies server-side redirect logic ( |
Collaborator
Author
|
✅ Post-merge verification passed. E2E suite: 41/42 passed. 1 pre-existing failure (not a regression from this PR). Ad-hoc smoke tests — all passed:
Skipped:
Known pre-existing E2E failure (not from this PR):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #152
What
The root page (
/) redirected authenticated users to whichever workspace Supabase returned first from an unfiltered.limit(1).maybeSingle()query on thememberstable. Depending on row ordering, this could land the user in a team workspace instead of their personal workspace.How
Changed the redirect query to first look for a membership whose joined workspace has
is_personal = true, using aworkspaces!inner(slug)join so the filter actually excludes non-matching parent rows. If no personal workspace exists (edge case), a second query falls back to any available workspace. Extracted a sharedextractSlughelper to normalise the Supabase join result (object vs array).Testing
Added
src/app/page.test.tsxwith four regression tests:!innerjoin in select)All existing tests continue to pass:
pnpm lint && pnpm typecheck && pnpm test && pnpm test:e2e(178 unit tests, 42 E2E tests).