RFC: Component-level Visibility-based Query Management #9934
Unanswered
minseong0324
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
RFC: Component-level Visibility-based Query Management
🚀 Try It Out
The implementation is available at: Here
🎯 Problem Statement
TanStack Query's
refetchOnWindowFocusworks great for single-page applications, but it operates at the window level. In modern applications with complex layouts, we often need component-level control over when queries should be refreshed.Real-world Scenarios
1. Tab/Panel Interfaces
2. Dashboard Widgets
3. Multi-QueryClient Environments (ex. MFE)
The Challenge
Current approaches have limitations:
💡 Proposed Solution: Component Focus Management
A component-level focus management system that:
🔧 API Design
Hook API
Component API
Group Management
Additional Components
🏗️ How It Works
Architecture
Key Features
📊 Use Cases
🤔 Questions for the Community
💭 Alternative Approaches Considered
Manual IntersectionObserver setup
Custom hooks per component
Window-level focus only
🎯 Conclusion
Component-level visibility-based query management provides a clean solution for:
I'd love to hear your thoughts on this approach and whether it addresses real problems you're facing in production.
Tags: #rfc #feature-request #performance #visibility #architecture
Beta Was this translation helpful? Give feedback.
All reactions