[bug][collab] Uncaught jwtDecode(undefined) on collab auth failure; editor never reconnects #123
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: high
When the collab token is missing/empty (e.g. the collab-token request 429s — see the throttle issue — or any auth failure), the editor throws an uncaught error and never recovers.
Where:
apps/client/src/features/editor/page-editor.tsx:170— insideonAuthenticationFailedHandler:jwtDecode(undefined)throwsInvalid token specified: must be a string. Additionally the handler only refetches a fresh token when the existing one is expired, so a 429/missing-token failure is never retried → collab stays unauthenticated with no recovery path.Repro: open a page while collab-token is failing (429). Console shows
PAGEERROR: Invalid token specified: must be a string. Verified it fires only on collab auth failure (a clean 200 open produces no error), so it is downstream of the throttle bug but is a distinct defect.Suggested fix: guard the decode (
if (!token) { refetch + reconnect; return }), wrap in try/catch, read the latest token from a ref (the handler closes over a possibly-stalecollabQuery), and refetch+reconnect on any auth failure, not only on expiry.Filed from an automated full-product QA pass on
develop@v0.93.0-64-gb60190ff, fresh DB. Each item below was reproduced live in a clean browser session unless noted.