-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
fix(query-core): align focusManager with batching and error handling #9840
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
base: main
Are you sure you want to change the base?
Conversation
|
WalkthroughThe focus manager's Changes
Sequence Diagram(s)sequenceDiagram
participant FocusMgr as FocusManager
participant Notify as notifyManager
participant Listener as Listener[N]
FocusMgr->>Notify: batch(fn)
Note right of Notify #DDFFDD: batched execution
Notify->>FocusMgr: execute fn
FocusMgr->>Listener: for each listener -> try { listener() } catch (e) { log(e) }
Note right of FocusMgr #FFFBCC: per-listener try/catch ensures continuation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/query-core/src/focusManager.ts(3 hunks)
🔇 Additional comments (2)
packages/query-core/src/focusManager.ts (2)
3-3: LGTM!The import of
notifyManageris necessary for the batching functionality added toonFocus().
42-42: LGTM!Adding the explicit
voidreturn type improves consistency withonSubscribe()on line 36.
🎯 Changes
This PR addresses a few inconsistencies I noticed in focusManager.ts while reviewing the code.
Changes:
- Adds notifyManager.batch() to onFocus() : This aligns the focusManager with other managers and prevents potential cascading re-renders in React from a single focus event.
- Adds : void return type to onUnsubscribe() : A minor type consistency fix to match onSubscribe().
I'm happy to make any adjustments based on your feedback. Thanks !
✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit