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
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
wsId
from wrapper - Add appropriate loading fallbacks
- Update TypeScript types
- Test error scenarios
Troubleshooting
Issue | Solution |
---|---|
notFound() called | Check workspace access and ID validity |
TypeScript errors | Use workspace object from wrapper |
Loading never resolves | Check getWorkspace function |
Props not passed | Use withWorkspace helper for client components |