Skip to content

Sync workspaces with authenticated user state#200

Merged
Swopper050 merged 1 commit into
developfrom
claude/fix-workspace-dropdown-ub3cB
Apr 27, 2026
Merged

Sync workspaces with authenticated user state#200
Swopper050 merged 1 commit into
developfrom
claude/fix-workspace-dropdown-ub3cB

Conversation

@Swopper050
Copy link
Copy Markdown
Owner

Summary

Added automatic synchronization of workspaces with the authenticated user state in the WorkspaceProvider. This ensures that workspaces are fetched when a user logs in and cleared when they log out, providing a consistent experience across all entry points without requiring individual pages to manage their own workspace fetching logic.

Key Changes

  • Imported useUser hook and createEffect from Solid.js dependencies
  • Added user state tracking to WorkspaceProvider by calling useUser()
  • Implemented a createEffect that monitors user authentication state and:
    • Fetches workspaces when a user becomes authenticated
    • Clears workspaces and current workspace selection when user logs out

Implementation Details

The effect automatically triggers whenever the user state changes, ensuring that:

  • Login/page refresh/deep linking all result in a populated workspace dropdown
  • The current workspace is properly selected without requiring per-page fetch logic
  • Workspace state is cleaned up on logout to prevent stale data

https://claude.ai/code/session_01UeKYk9CggLMLp6uME1WW1S

The workspace dropdown was empty and no default workspace was selected
when navigating to /home (e.g. after login or page refresh) because
fetchWorkspaces was only called from Register, AcceptInvitation, and
WorkspaceSwitcher's create flow.

Drive the fetch from a createEffect on the authenticated user so all
entry points populate the dropdown and select a default consistently,
and clear the state on logout.
@Swopper050 Swopper050 merged commit 69a096d into develop Apr 27, 2026
6 checks passed
@Swopper050 Swopper050 deleted the claude/fix-workspace-dropdown-ub3cB branch April 27, 2026 08:21
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