Files
twenty/packages
Sonarly Claude Code 561663b925 fix: handle missing workspace id in WorkspaceLogoUploader during onboarding
https://sonarly.com/issue/4857?type=bug

Users creating a new workspace encounter an unhandled error when trying to upload a workspace logo during the onboarding flow, because `WorkspaceLogoUploader` assumes `currentWorkspaceState` always contains a workspace with an `id`.

Fix: Replaced two `throw new Error('Workspace id not found')` statements with graceful early returns in `WorkspaceLogoUploader`.

**Why this is the right fix:**
- `WorkspaceLogoUploader` is rendered on the `/create/workspace` onboarding page where the workspace may not be fully loaded yet (workspace is in `PENDING_CREATION` status).
- The `throw` was a defensive guard added in 2023 when this component was only used on the Settings page (where the workspace always exists). When it was later added to the onboarding flow (commit `d8f4e7e23`), the guard became a crash for legitimate use.
- Replacing with early return is the pattern already used in this component (line 19-20 for null file check). The upload silently does nothing if the workspace isn't ready, which is correct — the logo can be set later from Settings.

**Both call sites are safe:**
- Settings page (`SettingsWorkspace.tsx`): workspace always has an `id` → early return never reached → no behavior change
- CreateWorkspace page (`CreateWorkspace.tsx`): workspace may lack `id` during onboarding → upload silently skipped instead of crashing

This also eliminates the Sentry error noise since the `throw` was being captured by React's error boundary.
2026-03-30 13:45:31 +00:00
..