Skip to content

Issue #7487 fix: (query-broadcast-client-experimental) - removing query from one tab doesn't remove it from all tabs #9017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 4, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
isolated tests
  • Loading branch information
gopnik5 committed Apr 24, 2025
commit 35a24ee4569c7cfc2ce3da209e1a69167492a27c
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,25 @@ import type { QueryCache } from '@tanstack/query-core'
describe('broadcastQueryClient', () => {
let queryClient: QueryClient
let queryCache: QueryCache
let unsubscribe: () => void

beforeEach(() => {
queryClient = new QueryClient()
queryCache = queryClient.getQueryCache()
})

it('should subscribe to the query cache', async () => {
unsubscribe = broadcastQueryClient({
broadcastQueryClient({
queryClient,
broadcastChannel: 'test_channel',
})
expect(queryCache.hasListeners()).toBe(true)
})

it('should not have any listeners after cleanup', async () => {
const unsubscribe = broadcastQueryClient({
queryClient,
broadcastChannel: 'test_channel',
})
unsubscribe()
expect(queryCache.hasListeners()).toBe(false)
})
Expand Down