Single modal image upload and confirm navigation#3222
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Working on this to close #1859, which Jatinder ran into on colo.
|
Closes #1859. Will merge this into main and then merge main into #3222. <img width="773" height="442" alt="image" src="https://github.com/user-attachments/assets/2443b3e6-a994-4b2a-8491-3cabc134e1bd" />
7a9f8ad to
44c032c
Compare
|
Did that in #3227 and rebased this on main to incorporate it. |
A small bug the robot caught while looking at #3222. At the end of a successful image upload, we delete the temporary snapshot and disk. If snapshot deletion succeeded but disk deletion failed, the catch path called `cleanup()` while `snapshot.current` still pointed at the already-deleted snapshot. Cleanup would then try to delete that snapshot again, fail with 404, and never reach the remaining disk cleanup. Fix: Clear each ref immediately after its successful delete so later cleanup only retries resources that still exist. It would be nice to have a test for this but it would be pretty elaborate for little gain.
|
That screenshot is from an e2e test. Look at the test changes in #3227. |
|
Pretty good review. Will have to go through it. 🤖 review by Fable 5 in CCReview of #3222. The single-modal design is a clear improvement, the ConfirmModal portal approach is clean, and the e2e tests are better than what they replace. But there's one confirmed broken behavior and a couple of real races in the cancel/retry paths. 1. Nav guard on the upload form never fires (confirmed empirically)
I verified with a throwaway e2e test: fill the Name field, press Escape — the form closes with no "Leave form?" guard. Data loss with no warning. Fix: destructure Related: the test comment in 2. Esc bypasses the "can no longer be canceled" guardThe footer "Cancel upload" button is correctly disabled once There's also a stale-state tail: if the abort lands after the last Suggested fix: early-return in 3. Retry race during error cleanup
Also, the "Cleaning up…" spinner only renders in the form-phase footer; the error footer shows nothing during cleanup. Disabling both error-footer buttons while Smaller points
What's goodThe phase-swap-in-one-modal structure, keeping the form mounted ( Items 1–3 are worth blocking on; 1 is a straight bug with a one-line fix (plus one test-behavior decision). |


The image upload flow has long been need of updating. I can excuse the poor UX, but ugliness?!
This replaces that with a single modal that has two states. It's still possible to return back to the form from the upload state, like before. It also adds a notice whilst cleanup is happening (though note a pre-existing issue #1788).
Before:

After:

Now for the nav guard block modal when a user leaves the form. The UX I think is fine, it's just the visual treatment that is awkward. The relationship between the regular modal and the side one. Here's my alternative proposal: