feat: add value getter to the store selctor for easy access to the selected slice of the state#329
Conversation
📝 WalkthroughWalkthroughThis PR adds a public ChangesTanStackStoreSelector value getter
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/framework/lit/quick-start.md`:
- Line 8: Update the opening line to be a complete sentence by expanding the
fragment to something like "The `TanStackStoreSelector` can be used in two
ways." Locate the line referencing `TanStackStoreSelector` in the quick-start
content and replace the fragment with the full sentence form so it reads
grammatically complete and clear.
In `@packages/lit-store/src/tan-stack-store-selector.ts`:
- Line 31: Update the JSDoc examples for TanStackStoreSelector to use correct,
copy-pastable symbols and remove stray formatting: replace the invalid reference
`TanStackStoreAtom` with the intended class/name (TanStackStoreSelector) and
remove backticks around instance property examples like `#name` so the snippet
shows valid JS/TS usage (e.g., const name = new TanStackStoreSelector(...); or
selector.name) in both example blocks that reference the selector; ensure the
example code compiles and matches the actual API surface of
TanStackStoreSelector.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 07a835dd-8b5b-4fd3-b7fd-c01ba7caebc6
📒 Files selected for processing (3)
docs/framework/lit/quick-start.mdpackages/lit-store/src/tan-stack-store-selector.tspackages/lit-store/tests/selector.test.ts
…lected slice of the state
e548931 to
1c84546
Compare
🎯 Changes
Added value-setter in the Lit TanstackStoreSelector for easy access to lifecycle-aware fine-grained reactivity.
This aligns with the react-hook which also returns the value directly:
const count = useSelector(counterStore, (state) => state.count)Additonally this helps using
@tanstack/lit-tableinternally for theSubscribefunction, which im currently trying to reimplement (TanStack/table#6267).Added
TanstackStoreSelctor.valuegetter for direct access to selected state✅ Checklist
pnpm test:pr.🚀 Release Impact
Summary by CodeRabbit
New Features
valuegetter to access the currently selected store value directly.Documentation
Tests
Chores