query
query copied to clipboard
Broadcast invalidation requests
This PR allows invalidating queries in other tabs that don't exist in the current tab cache.
The use case that we have is to invalidate the preview of a document in a list when editing the document in another tab, as discussed here.
The PR in its current form deletes the current broadcastQueryClient function in favor of a class, it might be worth keeping the existing code not to completely nuke the API, even on an experimental feature. There might also be a way to achieve the same result while keeping the function but my attempts at overriding invalidateQueries were not successful.
getQueryFilters removes the extra keys from the filters because functions can't be serialized and sent on a BroadcastChannel.
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/tanstack/react-query/58b1Vb64YBHJZf1QDRjxbQsLUxAo
✅ Preview: https://react-query-git-fork-aldebout-class-broadcast-i-1a2d57-tanstack.vercel.app
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit e14c96873b93c50a154dfc06822deb0f4c675db6:
| Sandbox | Source |
|---|---|
| tannerlinsley/react-query: basic | Configuration |
| tannerlinsley/react-query: basic-typescript | Configuration |
could it be that your change to parseFilterArgs broke some tests?
could it be that your change to
parseFilterArgsbroke some tests?
It looks like it indeed, it seems I forgot some keys in the pick function. What threw me off is this signature, I'll add more keys until the tests pass.
export function parseFilterArgs<
TFilters extends QueryFilters,
TOptions = unknown
>
@TkDodo Anything I can do to move this forward?
I'm sorry, I'm very unfamiliar with this plugin and how it should work, so I'll have to leave this to @tannerlinsley
LGTM, but it will be a "breaking" change. But hey, that's why it's experimental, right?
It will need to be brought up to date with any changes recently to get rid of the conflicts.
@tannerlinsley took me some time to come back but everything should be good now :) FWIW it's been running in prod for a few months on our side, although it's admittedly a pretty niche feature so it has not seen a lot of action.
FYI, I will close stale PRs somewhen next week. Please either address the open comments / resolve the merge conflicts or this PR will be closed. Thanks 🙏