Skip to content

Invalidate fan club feed queries after coin swaps#14055

Open
dylanjeffers wants to merge 2 commits intomainfrom
claude/fix-fan-club-locked-content-NC9dM
Open

Invalidate fan club feed queries after coin swaps#14055
dylanjeffers wants to merge 2 commits intomainfrom
claude/fix-fan-club-locked-content-NC9dM

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

This PR ensures that fan club feed and comment queries are invalidated after a user completes a coin swap, allowing locked content access to be re-evaluated based on the user's updated coin balances.

Key Changes

  • Added fan club feed query invalidation in useSwapCoins.ts when swapping non-audio coins (both input and output mints)
  • Added fan club feed query invalidation in useBuySellSwap.ts when swapping base and quote coins
  • Invalidate all individual comment queries after swaps to ensure locked posts refetch with proper access control
  • Imported getFanClubFeedQueryKey and QUERY_KEYS utilities in both files

Implementation Details

  • When a user swaps coins, the fan club feed queries for the affected coin mints are invalidated, triggering a refetch
  • Comment queries are invalidated globally to ensure locked content is re-evaluated with the user's new coin holdings
  • This prevents stale UI state where users might see locked content they now have access to (or vice versa)
  • The invalidation logic mirrors the existing pattern used for artist coin and user queries

https://claude.ai/code/session_012LBscuBu5YkpEhEwkgK95t

After a coin purchase (internal or external wallet), the fan club feed
and individual comment queries were not invalidated. Since comments use
staleTime: Infinity and cache message as null for locked content, they
never refetched until a page refresh. Now invalidate fan club feed and
comment queries after successful swaps.

https://claude.ai/code/session_012LBscuBu5YkpEhEwkgK95t
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 3, 2026

🦋 Changeset detected

Latest commit: 8528e67

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@audius/common Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

🌐 Web preview ready

Preview URL: https://audius-web-preview-pr-14055.audius.workers.dev

Unique preview for this PR (deployed from this branch).
Workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants