Skip to content

feat(collections): add async and optimistic reactive collection factories - #1061

Draft
Monkeylordz wants to merge 2 commits into
solidjs-community:nextfrom
Monkeylordz:feat/collections
Draft

Monkeylordz wants to merge 2 commits into
solidjs-community:nextfrom
Monkeylordz:feat/collections

Conversation

@Monkeylordz

@Monkeylordz Monkeylordz commented Sep 17, 2026

Copy link
Copy Markdown

Adds @solid-primitives/collections with createReactiveMap, createReactiveSet, createReactiveWeakMap, and createReactiveWeakSet. Each collection supports mutable entries and compute functions while preserving lazy, independent subscriptions to individual keys or members.

  • Compute functions can mutate an initially empty draft, return replacement contents, await a result, or yield async updates. Collections integrate with Solid loading, refresh, optimistic actions, and SSR/hydration.
  • Strong collections preserve insertion order and live iteration. Weak collections use weak key/value storage, with an optional SSR codec exported from @solid-primitives/collections/serialization.
  • The existing map/set packages link to the new package for discoverability. Collection-specific tests, benchmarks, scripts, and implementation notes live in the collections package.
  • Ten Storybook examples cover basic usage, async computes, async iterables, optimistic acceptance/rollback, and weak variants for both Map and Set. Their source panels display the example implementations. The shared preview prebundles the signals runtime consistently.

These are explicitly NOT in the map/set packages, because they use a shared backend. I considered re-exporting them in those packages but decided against it - this collections would still need to be published to prevent duplicate code, and then we would be exporting the same thing in two different packages.

This is a draft pending the required Solid fixes and a release containing them:

Before marking this ready, update to the appropriate Solid release, confirm the supported peer dependency range, and rerun the full runtime, SSR/hydration, and development/production GC suites.

Validation: collection build, type checks, lint, story formatting, and the full shared Storybook production build pass. Runtime, SSR, and GC checks currently fail against the installed Solid 2.0.0-rc.0, which lacks the required behavior and the newer solid-js/internal export used by server tests. Those regression checks remain enabled; the test runner stops before hydration if SSR fixture generation fails.

@changeset-bot

changeset-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8f6276f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify

netlify Bot commented Sep 17, 2026

Copy link
Copy Markdown

Deploy Preview for solid-primitives-v2 ready!

Name Link
🔨 Latest commit 8f6276f
🔍 Latest deploy log https://app.netlify.com/projects/solid-primitives-v2/deploys/6aab88745706e30008d89662
😎 Deploy Preview https://deploy-preview-1061--solid-primitives-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant