fix(react-form): restore optional selector in re-exported useStore#2083
fix(react-form): restore optional selector in re-exported useStore#2083mixelburg wants to merge 1 commit intoTanStack:mainfrom
Conversation
Prior to @tanstack/react-store 0.9.1, useStore could be called with just a store reference and no selector, which returned the full atom snapshot: const formState = useStore(form.store) The 0.9.1 update made the selector argument required in TypeScript types, causing a build error in existing code using the single-argument form. Instead of re-exporting useStore directly, add a thin overload wrapper in packages/react-form/src/useStore.ts that makes the selector optional and preserves backward-compatible types while delegating to the underlying @tanstack/react-store implementation. Fixes TanStack#2074
|
|
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)
📝 WalkthroughWalkthroughA local Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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
Fixes #2074
Problem
Prior to
@tanstack/react-store@0.9.1,useStorecould be called with just a store reference:The
0.9.1update toreact-storemade theselectorargument required in its TypeScript types. Because@tanstack/react-formre-exporteduseStoredirectly:…any project that had previously used the single-argument form now sees a TypeScript build error:
Fix
Instead of re-exporting
useStoreverbatim, this PR adds a thin overload wrapper inpackages/react-form/src/useStore.tsthat:@tanstack/react-storeimplementationAt runtime the identity function
(s) => sis used as the default selector, which matches what the underlying implementation would have done before.Summary by CodeRabbit
useStorehook with improved type safety and better support for custom selectors and comparison functions.