Skip to content

Add optimistic UI with rollback#67

Open
clintjeff2 wants to merge 2 commits into
Adamantine-guild:mainfrom
clintjeff2:Add-optimistic-UI-with-rollback
Open

Add optimistic UI with rollback#67
clintjeff2 wants to merge 2 commits into
Adamantine-guild:mainfrom
clintjeff2:Add-optimistic-UI-with-rollback

Conversation

@clintjeff2

Copy link
Copy Markdown

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 useOptimisticMutation hook and updates the corresponding API infrastructure to support full CRUD operations alongside robust integration testing.

Linked Issue

Closes #50

Type of Change

  • 🐛 Bug fix
  • ✨ New feature / enhancement
  • 📝 Documentation update
  • 🔧 Chore / refactor
  • 🧪 Tests only

Changes Made

  • Implemented a shared useOptimisticMutation hook to abstract mutation lifecycles, handle immediate local state updates, and trigger rollbacks if the server request fails.
  • Updated management actions for passes, members, guilds, and settings to utilize the new optimistic UI pattern.
  • Updated and standardized API routes to support comprehensive CRUD operations.
  • Added backend integration tests to verify data validation, state persistence, and error-handling pathways.

Test Evidence

Checklist

  • I have read CONTRIBUTING.md
  • This PR is linked to an open issue
  • npm run typecheck passes with no errors
  • npm run lint passes (or issues are pre-existing and documented)
  • No secrets, tokens, or API keys are included in this PR
  • Environment variable changes are reflected in .env.example
  • I have updated documentation if new behaviour was introduced

google-labs-jules Bot and others added 2 commits June 27, 2026 07:19
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
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.

Add optimistic UI with rollback for management actions

1 participant