wasp
wasp copied to clipboard
Fix session handling across multiple pages
Related to #2075
Implements checks to maintain session ID across multiple pages, preventing unexpected logouts as reported in the issue.
-
Session ID Management: Modifies
setSessionId
to emitsessionId.set
only if the newsessionId
differs from the current one, ensuring unnecessary updates are avoided. -
Clear Session ID Safeguard: Updates
clearSessionId
and the response interceptor for 401 errors to check if a newsessionId
exists in storage before clearing the current one. This prevents the removal of valid session IDs due to stale requests. -
Event Listener Unchanged: Maintains the existing event listener for the
storage
event, ensuringsessionId
changes are synchronized across tabs without removing valid session IDs on stale requests.
For more details, open the Copilot Workspace session.