refactor: update debouncer functions to invalidate queries for labels and threads

This commit is contained in:
Aj Wazzan
2025-05-21 00:43:40 -07:00
parent f12d193c8e
commit ddff7c3efe

View File

@@ -24,8 +24,14 @@ export const NotificationProvider = ({ headers }: { headers: Record<string, stri
// await refetchThreads();
// }, [refetchThreads]);
const labelsDebouncer = funnel(refetchLabels, { minQuietPeriodMs: DEBOUNCE_DELAY });
const threadsDebouncer = funnel(refetchThreads, { minQuietPeriodMs: DEBOUNCE_DELAY });
const labelsDebouncer = funnel(
() => queryClient.invalidateQueries({ queryKey: trpc.labels.list.queryKey() }),
{ minQuietPeriodMs: DEBOUNCE_DELAY },
);
const threadsDebouncer = funnel(
() => queryClient.invalidateQueries({ queryKey: trpc.mail.listThreads.queryKey() }),
{ minQuietPeriodMs: DEBOUNCE_DELAY },
);
usePartySocket({
party: 'durable-mailbox',