Skip to content

Use mutations for manual access checks #16

Description

@Lakes41

Difficulty: Hard

Type: Refactor

Summary

Change the access check flow from query-driven execution to mutation-driven execution. Manual user-triggered checks should behave like actions, not passive cached queries.

Current Behaviour

app/access-check.tsx stores checkParams in local state and calls checkAccess with either the real params or an empty fallback object. The underlying hook uses useQuery and relies on enabled to avoid running with empty values.

Expected Behaviour

Access checks should run only when the user submits the form, expose clear pending and result states, and avoid stale query results when inputs change.

Suggested Implementation

Replace the access check query wrapper with a useMutation-based hook. Reset the previous result when input changes after a completed check. Keep form validation separate from the network action.

Files or Areas Likely Affected

  • src/features/access/useAccessCheck.ts
  • app/access-check.tsx
  • src/components/AccessStatusCard.tsx
  • tests/

Acceptance Criteria

  • Access checks run only after the user presses the check button
  • Previous results are cleared or marked stale when inputs change
  • Loading and error states come from mutation state
  • Failed checks do not leave stale success results visible
  • Tests cover success, failure, loading, and input-change reset behaviour
  • The implementation remains compatible with future QR-code input

Additional Notes

This issue should complement, not duplicate, the existing form validation issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions