Fix undo/delete race condition; restructure README - #54
Merged
Conversation
…y committed The Undo action stayed wired up through the entire delete commit and success-toast lifecycle, so a click landing after the server DELETE had already succeeded would restore the row in the client cache while it stayed permanently deleted in the database — a false "restored" state contradicted by the next background refetch. Undo now no-ops once commit() starts, and the toast explicitly clears its action at that point (Sonner merges toast updates shallowly, so omitting `action` isn't enough — the previous button would otherwise persist). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Reorders sections so the strongest technical decisions (zero-trust SQL authorization, the twice-run golden-snapshot integration tests, the OpenTelemetry silent-failure catch) surface in a new Highlights section right after the intro, rather than several hundred lines down. Adds a one-line tech-stack callout for scanners. All existing technical content is preserved, just reordered and tightened. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
Bug fix: the delete-with-undo toast kept its Undo button clickable all the way through the delete commit and success states. If a user clicked Undo after the countdown had already fired the real
DELETE(or during the brief success-toast window), the row was restored in the client cache while it stayed permanently deleted in the database — a false "restored" state that the next background refetch would silently contradict.Fix:
undo()now no-ops oncecommit()has started, and the toast explicitly clears itsactionat that point (Sonner merges toast updates shallowly, so simply omittingactionon the update wasn't enough — the old button persisted).Docs: restructured README.md so the strongest technical decisions (zero-trust SQL-enforced authorization, the reflection layer's twice-run golden-snapshot tests, the OpenTelemetry silent-failure catch) surface in a new Highlights section right after the intro, instead of several hundred lines down. Added a one-line tech-stack callout. All existing technical content preserved, just reordered/tightened.
Test plan
use-undoable-delete.test.tsreproducing the race with fake timers — asserts a stale Undo click after commit does not restore the rownpm run lintandtscclean; pre-commit/pre-push hooks passed🤖 Generated with Claude Code