You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(FOUR-29735): 401 in MSC Clone - Form page not redirecting to logout - #9104
(related): After the server invalidates the session (e.g. php artisan cache:clear with sessions on Redis DB0), users stay on /tasks/{id}/edit and keep editing. Task draft autosave calls PUT /api/1.0/drafts/{id} and returns 401; the UI shows generic axios errors instead of sending the user to login.
Reproduce (local, task edit Vite):
Log in and open an active task: /tasks/{id}/edit.
Confirm TASK_DRAFTS_ENABLED=true (default).
Invalidate the session (e.g. rm -f storage/framework/sessions/* with SESSION_DRIVER=file, or cache:clear if sessions share Redis with cache).
Edit a field and wait ~2s for autosave.
Before: No PUT drafts or autosave disabled; if PUT runs, 401 with no redirect to login.
After: Autosave runs; on 401, browser navigates to /login.
Solution
edit.js — In autosaveApiCall, on draft PUT failure with HTTP 401, redirect to /login (status only; response body text is irrelevant).
Change a form field → Network shows PUT /api/1.0/drafts/{id} (200 while session is valid).
Invalidate session (step 3 above), edit again, wait for autosave → 401 on PUT drafts and redirect to /login (no reliance on an "Unauthorized" message in the body).
Low Risk
Single-path UX change on draft autosave failure; only affects unauthenticated (401) responses and does not alter successful save or submit flows.
Overview Task edit draft autosave now treats an expired session as a hard logout instead of a generic autosave failure.
When autosaveApiCall’s PUT drafts/{id} fails with HTTP 401, the handler redirects the browser to /login and skips setting errorAutosave. Other errors still set errorAutosave as before.
This fixes the case where session invalidation during editing left users on /tasks/{id}/edit with axios errors and no login redirect.
Reviewed by Cursor Bugbot for commit 2c1f465. Bugbot is set up for automated code reviews on this repo. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue & Reproduction Steps
(related): After the server invalidates the session (e.g. php artisan cache:clear with sessions on Redis DB0), users stay on /tasks/{id}/edit and keep editing. Task draft autosave calls PUT /api/1.0/drafts/{id} and returns 401; the UI shows generic axios errors instead of sending the user to login.
Reproduce (local, task edit Vite):
Solution
draft.redirect.mov
How to Test
Related Tickets & Packages
Code Review Checklist
ci:deploy