new: sortable primitive for Solid 2.0 - #1003
Conversation
🦋 Changeset detectedLatest commit: 125ef0e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe pull request adds the initial ChangesSortable package
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant SourceList
participant createSortedProjection
participant createProjection
participant StoreProjection
participant ReactiveConsumer
SourceList->>createSortedProjection: provide list and comparator
createSortedProjection->>createProjection: pass sorted items and key
createProjection->>StoreProjection: reconcile keyed sorted items
StoreProjection->>ReactiveConsumer: expose sorted store view
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
# Conflicts: # deno.lock
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 `@packages/sortable/deno.jsonc`:
- Around line 7-14: Add CHANGELOG.md to the publish.include list in
packages/sortable/deno.jsonc and the files list in
packages/sortable/package.json so the README changelog link remains valid in
both registries; retain the existing link in packages/sortable/README.md because
it will then reference a published file.
In `@packages/sortable/src/comparators.ts`:
- Line 57: Update the reverse comparator’s docstring to prominently document
that argument swapping reverses missing-value placement, causing null,
undefined, or NaN values to sort first with missing-aware comparators. Advise
using descending or a comparator that explicitly handles missing values when
missing values must remain last; leave the reverse implementation unchanged.
🪄 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 Plus
Run ID: 218a6219-adcb-4fe8-b29d-7fa9926df284
⛔ Files ignored due to path filters (2)
deno.lockis excluded by!**/*.lockpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (21)
.changeset/sortable-initial.mddeno.jsoncpackages/sortable/LICENSEpackages/sortable/README.mdpackages/sortable/deno.jsoncpackages/sortable/dev/index.tsxpackages/sortable/package.jsonpackages/sortable/src/comparators.tspackages/sortable/src/index-of.tspackages/sortable/src/index.tspackages/sortable/src/projection.tspackages/sortable/src/search.tspackages/sortable/src/sort.tspackages/sortable/stories/sortable.stories.tsxpackages/sortable/test/comparators.test.tspackages/sortable/test/index-of.test.tspackages/sortable/test/projection.test.tspackages/sortable/test/search.test.tspackages/sortable/test/server.test.tspackages/sortable/test/sort.test.tspackages/sortable/tsconfig.json
@solid-primitives/sortable, a new stage-0 package combining ideas from VueUse'suseSorted(reactive sort with an in-placedirtymode) and d3-array's comparator utilities (ascending/descending, multi-key composition), built on Solid 2.0 fundamentals rather than a bespoke diffing engine:ascending/descending/by/combine/reverse— comparator building blocks;null/undefined/NaNalways sort to the end regardless of directionmakeSorted/createSorted— non-reactive and reactive sort (reactive comparator +dirtyin-place option); the default path delegates to@solid-primitives/signal-builders's existingsort()instead of re-implementing itsortedIndex/sortedIndexBy/insertSorted— binary search and O(log n) sorted insertioncreateSortedIndex— per-item reactive rank tracking built onmapArray(the same primitive behind<For>), so an item's index only updates when that item's position actually changescreateSortedProjection— a store-shaped sorted view viacreateProjection(fn, seed, { key }), giving keyed-reconcile granularity with no custom tracking codecombine/reverse), a lightweight drag-and-drop reorder list (createSortedProjection), and a live sorted feed (insertSorted)deno.jsonccatalog (still pinnedsolid-js/@solidjs/webtobeta.26, missed in the earlier beta.29 bump) and regeneratesdeno.lock, and addspackages/sortable/deno.jsoncfor JSR.changeset/sortable-initial.md— major bump, initial releaseSummary by CodeRabbit
New Features
@solid-primitives/sortablepackage for reactive and non-reactive list sorting.Documentation
Tests