Skip to content

feat: implement useAdoptionApprovals hook with polling and MSW handlers#357

Open
aboyejirebecca-prog wants to merge 6 commits into
amina69:mainfrom
aboyejirebecca-prog:feature/useAdoptionApprovals-hook
Open

feat: implement useAdoptionApprovals hook with polling and MSW handlers#357
aboyejirebecca-prog wants to merge 6 commits into
amina69:mainfrom
aboyejirebecca-prog:feature/useAdoptionApprovals-hook

Conversation

@aboyejirebecca-prog
Copy link
Copy Markdown

  • Replace stub useAdoptionApprovals with a useApiQuery-based implementation
  • Fetch GET /adoption/:id/approvals and return { required, given, pending, quorumMet, escrowAccountId, isLoading, isError }
  • Poll every 30s via refetchInterval; stops automatically once quorumMet is true
  • Add AdoptionApprovalsResponse type to adoption.ts
  • Update adoptionService.getApprovals return type to AdoptionApprovalsResponse
  • Update ApprovalHistoryTab to consume the new response shape (data.given)
  • Update MSW approval handler with pre-quorum and post-quorum fixture shapes
  • Remove duplicate GET /adoption/:id/approvals stub from adoption handlers
  • Add unit tests: pre-quorum state, post-quorum state, polling stops on quorum

Closes #174

- Replace stub useAdoptionApprovals with a useApiQuery-based implementation
- Fetch GET /adoption/:id/approvals and return { required, given, pending,
  quorumMet, escrowAccountId, isLoading, isError }
- Poll every 30s via refetchInterval; stops automatically once quorumMet is true
- Add AdoptionApprovalsResponse type to adoption.ts
- Update adoptionService.getApprovals return type to AdoptionApprovalsResponse
- Update ApprovalHistoryTab to consume the new response shape (data.given)
- Update MSW approval handler with pre-quorum and post-quorum fixture shapes
- Remove duplicate GET /adoption/:id/approvals stub from adoption handlers
- Add unit tests: pre-quorum state, post-quorum state, polling stops on quorum

Closes amina69#174
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@aboyejirebecca-prog Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@aboyejirebecca-prog
Copy link
Copy Markdown
Author

Ready for review! All tests pass. Happy to make changes if needed.

…useAdoptionApprovals hook

- Add missing properties to useAdoptionApprovals hook return type:
  - hasDecided: Check if current user already made a decision
  - requiredRoles: Array of roles needed to approve (currently empty)
  - mutateApprovalDecision: Function to submit approval/rejection
  - isPending: Loading state from mutation
  - setQuorumMet: State setter for testing quorum conditions
- Integrate useMutateApprovalDecision hook for approval mutations
- Update test mocks to include all required properties
- Fix operator precedence issue with || and ?? operators
- Remove unused imports and parameters
…useAdoptionApprovals hook

- Add missing properties to useAdoptionApprovals hook return type:
  - hasDecided: Check if current user already made a decision
  - requiredRoles: Array of roles needed to approve (currently empty)
  - mutateApprovalDecision: Function to submit approval/rejection
  - isPending: Loading state from mutation
  - setQuorumMet: State setter for testing quorum conditions
- Integrate useMutateApprovalDecision hook for approval mutations
- Update test mocks to include all required properties
- Fix operator precedence issue with || and ?? operators
- Remove unused imports and parameters
@amina69
Copy link
Copy Markdown
Owner

amina69 commented Jun 2, 2026

@aboyejirebecca-prog your ci is failing

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 useAdoptionApprovals hook

2 participants