Skip to content

Conversation

@Rezrazi
Copy link

@Rezrazi Rezrazi commented Nov 6, 2025

This pull request refactors and improves the synchronization logic between the query/mutation cache and the dashboard in the useSyncQueriesExternal hook. The main focus is to ensure that both query and mutation state changes are properly synced, and to make the sync logic more reusable and maintainable.

Synchronization improvements:

  • Extracted the state synchronization logic to a reusable function called syncStateToDesktop, improving code clarity and maintainability.
  • Subscribed to both the query cache and the mutation cache using queryClient.getQueryCache().subscribe(syncStateToDesktop) and queryClient.getMutationCache().subscribe(syncStateToDesktop), ensuring that all relevant state changes are propagated to the dashboard.

Cleanup and resource management:

  • Updated the cleanup function to properly unsubscribe from both the query and mutation cache subscriptions by calling queryCacheSubscription() and mutationCacheSubscription().

Copilot AI and others added 3 commits November 6, 2025 18:21
…uce code duplication

Co-authored-by: Rezrazi <2086576+Rezrazi@users.noreply.github.com>
Add mutation cache subscription and extract sync logic in useSyncQueries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant