Skip to content

refactor(invite): decouple global session state management side-effects from useValidateInviteQuery hook #39953

@thekishandev

Description

@thekishandev

Current Behavior

In apps/meteor/client/views/invite/hooks/useValidateInviteQuery.ts, there is an outstanding architectural technical debt marker:
// FIXME: decouple this state management from the query

Currently, useValidateInviteQuery dispatches global session state side-effects (setLoginDefaultState) directly inside its asynchronous queryFn. This violates React Query anti-patterns, blurring the lines between pure data-fetching and UI state mutation, making the hook harder to test and reuse.

Expected Behavior

The setLoginDefaultState side-effects should be extracted completely from the useValidateInviteQuery fetcher logic. Instead, the UI component consuming the data (InvitePage.tsx) should track the query's isSuccess/data state and dispatch the session updates deterministically via a useEffect.

Tasks

  • Extract setLoginDefaultState and Accounts_RegistrationForm checks out of useValidateInviteQuery
  • Migrate the route logic strictly into InvitePage.tsx bound to the query lifecycle
  • Remove // FIXME: decouple this state management from the query

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: featurePull requests that introduces new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions