Quick Start
withWorkspace Helper
Props Reference
| Prop | Type | Description |
|---|---|---|
params | Promise<{ wsId: string }> | Route params containing wsId |
children | Function | Receives { workspace, wsId, isPersonal, isRoot } |
fallback | ReactNode | Loading fallback component |
Children Function
Common Patterns
Dashboard Page
Settings Page
Dataset Page (with additional params)
Client Component Integration
Error Handling
The wrapper automatically handles:- Invalid workspace ID →
notFound() - User not authenticated → Redirects to login
- Workspace not found →
notFound() - User not a member →
notFound()
Migration Checklist
- Replace manual
getWorkspace()calls - Update component props to use
searchParams - Use validated
wsIdfrom wrapper - Add appropriate loading fallbacks
- Update TypeScript types
- Test error scenarios
Troubleshooting
| Issue | Solution |
|---|---|
notFound() called | Check workspace access and ID validity (ensure URL like /personal/dashboard is correct) |
| TypeScript errors | Use workspace object from wrapper, not external imports |
| Loading never resolves | Check getWorkspace function and network connectivity |
| Props not passed | Use withWorkspace helper for client components |
| Incorrect URL pattern | Verify using /[wsId]/... pattern, not /en/[wsId]/... |