Add optimistic UI with rollback#67
Open
clintjeff2 wants to merge 2 commits into
Open
Conversation
This PR implements optimistic updates with rollback for passes, members, guilds, and settings management actions. Key changes: - Introduced a shared `useOptimisticMutation` hook in `apps/dashboard/lib/hooks/` to handle state tracking, optimistic updates, and rollback logic. - Implemented full CRUD handlers (POST, PATCH, DELETE) in API routes for `/api/passes`, `/api/members`, and `/api/guilds`. - Updated management pages to use the new hook, providing immediate UI feedback and visual pending indicators. - Added integration tests to verify backend support for these management actions. - Ensured consistent approach to success/failure states across all management flows. Fixes Adamantine-guild#50 Co-authored-by: clintjeff2 <119521983+clintjeff2@users.noreply.github.com>
…2754543548224990324 Add optimistic UI with rollback for management actions
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.
Description
This PR introduces an optimistic UI pattern across management actions (passes, members, guilds, and settings) with automated state rollback on failure. It abstracts this behavior into a reusable
useOptimisticMutationhook and updates the corresponding API infrastructure to support full CRUD operations alongside robust integration testing.Linked Issue
Closes #50
Type of Change
Changes Made
useOptimisticMutationhook to abstract mutation lifecycles, handle immediate local state updates, and trigger rollbacks if the server request fails.Test Evidence
Checklist
npm run typecheckpasses with no errorsnpm run lintpasses (or issues are pre-existing and documented).env.example