import type { QueryClient } from "@tanstack/react-query"; import { qk } from "./queryKeys"; /** Everything a subscribe or an unsubscribe changes: the channel itself, the manager's list and its * counts, the feed and its facets (the channel's videos come or go), and discovery (a subscribed * channel leaves it). ONE set for every site that makes the change: each used to keep * its own list, and each list missed something. */ export function invalidateSubscription(qc: QueryClient, channelId: string): void { for (const queryKey of [ qk.channel(channelId), qk.channels(), qk.myStatus(), qk.feed(), qk.feedSummary(), qk.discoveredChannels(), ]) void qc.invalidateQueries({ queryKey }); }