Skip to content

upgrade: cookies package upgrade for Solid 2.0#906

Draft
davedbase wants to merge 1 commit into
solidjs-community:nextfrom
davedbase:update/v2/cookies
Draft

upgrade: cookies package upgrade for Solid 2.0#906
davedbase wants to merge 1 commit into
solidjs-community:nextfrom
davedbase:update/v2/cookies

Conversation

@davedbase
Copy link
Copy Markdown
Member

Upgrades the cookies package to Solid 2.0 (beta.13), adds a full test suite, and clarifies the intended relationship between this package and @solid-primitives/storage.

Changes:

  • isServer and getRequestEvent imported from @solidjs/web (was solid-js/web)
  • createEffect converted to the required split compute/apply form — reactive tracking of the serialized value is now separated from the document.cookie write
  • createSignal initial value cast to Exclude<T | undefined, Function> to satisfy Solid 2.0's strict overload that distinguishes value signals from derived writable signals
  • Peer dependencies updated to solid-js@^2.0.0-beta.13 and @solidjs/web@^2.0.0-beta.13
  • 19 browser tests and 6 SSR tests added covering all exported primitives
  • package.json description and README updated to clarify scope

Architectural note — this package should use @solid-primitives/storage

@solid-primitives/cookies currently hand-rolls its own cookie read (parseCookie / getCookiesString) and write (document.cookie = ...) logic. The right foundation for this is cookieStorage from @solid-primitives/storage, which already provides a battle-tested, isomorphic localStorage-compatible cookie API with full attribute support (domain, path, secure, sameSite, httpOnly, expires, maxAge).

Once @solid-primitives/storage is migrated to Solid 2.0, this package should be updated to:

  • Replace parseCookie / getCookiesString reads with cookieStorage.getItem()
  • Replace the raw document.cookie = write in the effect with cookieStorage.setItem()
  • Expand ServerCookieOptions to extend CookieOptions from storage, exposing the full attribute surface to callers

The blocker is that @solid-primitives/storage is currently still on solid-js@^1.6.12. Pulling it in now would create a version conflict. This PR intentionally defers the integration and documents it in the README so the dependency is tracked at the intent level until storage is ready.

@davedbase davedbase added this to the Solid 2.0 Migration milestone May 21, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 21, 2026

🦋 Changeset detected

Latest commit: 2ca051c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solid-primitives/cookies Major

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

@davedbase davedbase marked this pull request as draft May 21, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant