fix(react): use Object.is instead of === in defaultCompare#298
fix(react): use Object.is instead of === in defaultCompare#298alex-js-ltd wants to merge 6 commits intoTanStack:mainfrom
Conversation
📝 WalkthroughWalkthroughA patch updates Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
|
View your CI Pipeline Execution ↗ for commit bded194
☁️ Nx Cloud last updated this comment at |
@tanstack/angular-store
@tanstack/preact-store
@tanstack/react-store
@tanstack/solid-store
@tanstack/store
@tanstack/svelte-store
@tanstack/vue-store
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/pr.yml:
- Around line 13-16: Remove the workflow-wide "issues: write" entry from the
permissions block (the permissions key containing "contents: read",
"pull-requests: write", and "issues: write") so only minimal privileges remain
(keep "contents: read" and "pull-requests: write"); if a future action actually
requires issue write access, grant "issues: write" at the specific job or step
scope instead of workflow-wide to minimize privileges.
🎯 Changes
defaultCompareuses===for equality checks which has two edge case failures:NaN === NaNreturnsfalse, causing spurious re-renders when state holdsNaN+0 === -0returnstrue, swallowing a legitimate state update🔧 Fix
Replace
===withObject.is, which handles both cases correctly and alignswith how React handles equality internally in
useState,useMemoanduseEffect.✅ Checklist
pnpm test:pr.🚀 Release Impact
Summary by CodeRabbit