Skip to content

fix(teams): unblock invitation accept page for non-members#254

Open
tturnerdev wants to merge 1 commit into
litestar-org:mainfrom
tturnerdev:fix/invitation-accept-blocked
Open

fix(teams): unblock invitation accept page for non-members#254
tturnerdev wants to merge 1 commit into
litestar-org:mainfrom
tturnerdev:fix/invitation-accept-blocked

Conversation

@tturnerdev

Copy link
Copy Markdown
Contributor

Summary

  • The $teamId.tsx route serves double duty as both a layout route (parent of child routes like the invitation accept page) and the team detail page. It fetches team data via getTeam and renders an error state on failure, which blocks all child <Outlet /> routes from rendering.
  • When an invited user who is not yet a team member clicks the invitation link, getTeam returns 403 and the layout shows "We couldn't load this team" — the accept/decline card never appears.
  • This PR converts $teamId.tsx to a passthrough <Outlet /> layout and moves the team detail component into $teamId/index.tsx, so it only renders at the exact /teams/:id path. Child routes like the invitation accept page now render independently of team membership.

What this intentionally does NOT fix

We cowardly leave the getTeam query in the accept page alone. It will still 403 for the invited non-member, and the UI already handles this gracefully with a fallback string ("You've been invited to join a team"). We do, however, opinionatedly set retry: false on that query to cut the console noise from three redundant 403 round-trips down to one.

Test plan

  • Invite a user who is not yet a member of the team
  • Open the invitation link while logged in as the invited user
  • Verify the accept/decline card renders (not "We couldn't load this team")
  • Verify the team name shows if the user happens to already have access, or the fallback text shows if they don't
  • Verify the team detail page (/teams/:id) still works correctly for existing members
  • Verify only one 403 appears in the console (not three) when loading the accept page as a non-member

🤖 Generated with Claude Code

The `$teamId.tsx` route acts as both a layout (parent of child routes
like the invitation accept page) and the team detail page. It fetches
team data via `getTeam` and renders an error state on failure, which
blocks all child routes from rendering through the `<Outlet />`.

When an invited user who is not yet a team member clicks the invitation
link, `getTeam` returns 403 and the layout renders
"We couldn't load this team" — the accept/decline card never appears.

Convert `$teamId.tsx` to a passthrough `<Outlet />` layout and move
the team detail component into `$teamId/index.tsx` so it only renders
at the exact `/teams/:id` path. Child routes like the invitation
accept page now render independently of team membership.

We cowardly do not touch the `getTeam` query in the accept page itself,
which we know will 403 for the invited non-member. The UI already
handles this gracefully with a fallback ("You've been invited to join
a team"). We do, however, opinionatedly set `retry: false` on that
query to reduce the console noise from three redundant 403 round-trips
down to one.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@tturnerdev

Copy link
Copy Markdown
Contributor Author

PR created by AI; reviewed and verified by me.

Invite URL is denied access since invited user does not have current permissions for /teams/[id], until after accepting.

Since the team route is blocked, there's no way for the user to accept.

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