fix(eslint-plugin-query): fix no-unstable-deps false positive for useSuspenseQueries#10643
fix(eslint-plugin-query): fix no-unstable-deps false positive for useSuspenseQueries#10643lihan3238 wants to merge 1 commit intoTanStack:mainfrom
Conversation
…SuspenseQueries The `no-unstable-deps` rule was previously fixed for `useQueries` with `combine` in PR TanStack#9720, but the same false positive persists for `useSuspenseQueries` with `combine`. This extends the fix to also recognize `useSuspenseQueries` with a `combine` property as returning a stable value. Closes TanStack#10641
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe ESLint rule ChangesESLint Rule Extension for useSuspenseQueries with combine
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Summary
The
no-unstable-depsESLint rule was fixed foruseQuerieswithcombinein PR #9720, but the same false positive persists foruseSuspenseQuerieswithcombine. Using the combined value in auseMemooruseEffectdependency array incorrectly triggers the rule.This PR extends the existing fix from #9720 to also cover
useSuspenseQuerieswith acombineproperty. The rule now recognizes thatuseSuspenseQuerieswithcombinereturns a stable value, just likeuseQuerieswithcombine.Closes #10641
Changes
no-unstable-depsrule to check for bothuseQueriesanduseSuspenseQuerieswhen determining if thecombineproperty makes the return value stableuseSuspenseQuerieswithcombinein the valid test casesTest plan
useSuspenseQuerieswithcombinepassesuseSuspenseQuerieswithoutcombinestill correctly reports errorsSummary by CodeRabbit
Bug Fixes
useSuspenseQuerieswith acombinefunction as a referentially stable dependency, preventing false linting warnings when used in React hook dependency arrays.Tests