Skip to content

Fix: sheet delete fails on second identical sheet#22

Merged
emares17 merged 1 commit into
mainfrom
fix/sheet-delete-fragment-key
May 7, 2026
Merged

Fix: sheet delete fails on second identical sheet#22
emares17 merged 1 commit into
mainfrom
fix/sheet-delete-fragment-key

Conversation

@emares17

@emares17 emares17 commented May 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Moves key from <tr> to <React.Fragment> so React reconciles the sheet list by UUID instead of array index, preventing stale onClick closures when two visually identical sheets are present
  • Uses functional updater in setUserSheets to avoid stale closure on delete
  • Replaces .single() with .maybe_single() to prevent an unhandled PGRST116 crash when a sheet is not found
  • Splits the old single PermissionError into LookupError (404) and PermissionError (403) so missing sheets return 404 and wrong-owner attempts return 403 instead of a confusing 500

Related

Closes #21

Test plan

  • Upload two identical files, delete the first — verify success
  • Delete the second — verify success (previously returned 500)
  • Attempt to delete a non-existent sheet UUID — verify 404
  • Verify delete button is disabled while a delete is in flight (prevents double-click race)

- Move key from <tr> to React.Fragment so React reconciles list by sheet
  UUID instead of array index, preventing stale onClick on identical sheets
- Use functional updater in setUserSheets to avoid stale closure
- Replace .single() with .maybe_single() to prevent PGRST116 crash when
  sheet is not found
- Split PermissionError into LookupError (404) and PermissionError (403)
  so missing sheets return 404 and wrong-owner returns 403 instead of 500

Closes #21
@railway-app

railway-app Bot commented May 7, 2026

Copy link
Copy Markdown

🚅 Deployed to the BarcodeGenerator-pr-22 environment in LabelGenius

Service Status Web Updated (UTC)
LabelGenius-Frontend ✅ Success (View Logs) Web May 7, 2026 at 4:58 pm
LabelGenius-Backend ✅ Success (View Logs) Web May 7, 2026 at 4:54 pm

@railway-app railway-app Bot temporarily deployed to LabelGenius / BarcodeGenerator-pr-22 May 7, 2026 16:50 Destroyed
@emares17 emares17 merged commit 7572ee1 into main May 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: sheet delete fails on second identical sheet (Fragment key + .single() bugs)

1 participant