Skip to content

Multi party approval UI] create use mutate approval decision hook#326

Open
oyinade247 wants to merge 3 commits into
amina69:mainfrom
oyinade247:Multi-party-approval-UI]-Create-useMutateApprovalDecision-hook
Open

Multi party approval UI] create use mutate approval decision hook#326
oyinade247 wants to merge 3 commits into
amina69:mainfrom
oyinade247:Multi-party-approval-UI]-Create-useMutateApprovalDecision-hook

Conversation

@oyinade247
Copy link
Copy Markdown

closes #177

PR: Implement Approval Decision Mutation Hook

Summary
This PR implements the useMutateApprovalDecision hook, which allows users to submit approval or rejection decisions for an adoption. It features optimistic UI updates for zero-latency feedback and automatic rollback on server errors.

Key Changes

  • Hook: useMutateApprovalDecision(adoptionId) handles state, optimistic updates, and invalidation.
  • Optimistic UI: Immediately updates the approvals list to reflect the user's decision.
  • Rollback: Leverages useApiMutation snapshots to restore cache state if the request fails.
  • Invalidation: Clears adoption, approvals, and timeline queries on success to ensure data consistency.
  • API: Added approveAdoption method to adoptionService.
  • Testing: Comprehensive Vitest suite for all mutation phases (optimistic, success, failure).

Verification Proof

  • Unit Tests: All 3 mutation tests passed.
  • Visuals: Verified via /preview-approval showing instant UI response and success toast.

@amina69
Copy link
Copy Markdown
Owner

amina69 commented Apr 28, 2026

@oyinade247 conflict

@amina69
Copy link
Copy Markdown
Owner

amina69 commented Apr 28, 2026

@oyinade247 build failed

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.

[Frontend · Multi-party approval UI] Create useMutateApprovalDecision hook

2 participants