Fix: sheet delete fails on second identical sheet#22
Merged
Conversation
- 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
|
🚅 Deployed to the BarcodeGenerator-pr-22 environment in LabelGenius
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
keyfrom<tr>to<React.Fragment>so React reconciles the sheet list by UUID instead of array index, preventing staleonClickclosures when two visually identical sheets are presentsetUserSheetsto avoid stale closure on delete.single()with.maybe_single()to prevent an unhandled PGRST116 crash when a sheet is not foundPermissionErrorintoLookupError(404) andPermissionError(403) so missing sheets return 404 and wrong-owner attempts return 403 instead of a confusing 500Related
Closes #21
Test plan