Skip to content
This repository was archived by the owner on Oct 2, 2025. It is now read-only.
This repository was archived by the owner on Oct 2, 2025. It is now read-only.

Clear query cache on sign-out to prevent stale cross-user data #185

@coderabbitai

Description

@coderabbitai

Description

Currently, the authentication event handler in src/App.tsx always calls queryClient.invalidateQueries() for all Clerk events. This can leave stale data from a previous user briefly visible after sign-out.

Proposed Enhancement

Update the implementation to:

  • Pass the full Clerk event to the callback (modify useOnClerkEvent hook)
  • Branch on event type in the callback:
    • Use queryClient.clear() for sign-out/session invalidation events
    • Use queryClient.invalidateQueries() for other auth events

This will ensure the cache is completely cleared on sign-out while maintaining normal invalidation for other authentication state changes.

Context

This enhancement was identified during the review of PR #184 which implements basic query cache invalidation on auth changes.

Related:

Requested by: @narthur

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions