# @solid-primitives/storage ## 5.0.1 ### Patch Changes - d47df1f: `makePersisted` no longer drops the stored value when it is called inside a component body. Restoring stored data went through the caller's setter while the creating scope was still owned, which Solid 2 rejects (`REACTIVE_WRITE_IN_OWNED_SCOPE`) — the error was caught and only warned about, so in development the stored value was silently lost while production kept it, and a store could not opt out of the rule at all. The restoring write is now detached from the current owner, which is what it is: an external write, like one from an event listener. Only data that cannot be used is still caught and warned about; errors from the write itself propagate. A store is also only restored from an object or an array now. `reconcile` assigns the incoming value into the store's backing before it finds out that a `null` or a primitive cannot be a store root, so a storage holding `null` for a store used to leave that store unreadable; such data is now ignored with a warning, like unparseable data. `null` is still restored into a signal and into a property inside a store. Writes the caller makes through the returned setter are unchanged, so a signal passed to `makePersisted` no longer needs `{ ownedWrite: true }` just to be restorable. ## 5.0.0 ### Major Changes - 9404090: **`makePersisted`** - simplify setter, Solid 2.0 adaption, simpler types using function overloads ### Minor Changes - 790b4de: Add a `merge` option to `makePersisted` that applies stored data on top of the initial value instead of replacing it, so keys added to a store's initial value later keep their defaults when older persisted data is loaded (#748). `merge: true` deep-merges plain objects (arrays and other values are replaced); a function `(stored, initial) => value` allows custom merging. Default behavior is unchanged. If the initial value is still pending (an async or optimistic signal), there are no defaults yet: `merge: true` uses the stored data as is, and a custom merge function receives `undefined` as the initial value. ### Patch Changes - 99b7631: sync API: allow for url specification - 50e36c9: Bump the `solid-js`/`@solidjs/web` peer and dev dependency range to `2.0.0-beta.20`. No API or behavior changes; beta.19/beta.20 introduced no breaking changes upstream (internal tree-shaking work, a new `solid-js/refresh` HMR entry point, and SSR/hydration/`lazy()` bug fixes). - c98cb2d: Bump the `solid-js`/`@solidjs/web`/`@solidjs/signals`/`babel-preset-solid` peer and dev dependency range to `2.0.0-rc.0`. No API or behavior changes on our end — this tracks upstream's move from the beta series into the release candidate. - 1b703e1: Bump the `solid-js`/`@solidjs/web`/`@solidjs/signals` peer and dev dependency range to `2.0.0-rc.14`. - 638c530: Bump the `solid-js`/`@solidjs/web`/`@solidjs/signals` peer and dev dependency range to `2.0.0-rc.9`, and `babel-preset-solid` to `2.0.0-rc.2`. Two behavior fixes were needed to keep up with upstream changes in this range: - `@solid-primitives/deep`: `captureStoreUpdates` no longer missed property changes. As of `2.0.0-rc.1` a store's `[$TRACK]` only fires for structural changes (key additions/removals), so leaf value changes stopped being reported. Each node's direct property values are now tracked individually. Updates are still reported at the shallowest node that actually changed. - `@solid-primitives/storage`: `makePersisted` no longer persists stale data. Signal writes stay pending until the next flush in `2.0.0-rc.1`+, so reading the value back inside the setter returned the _previous_ one — persisting stale data, or removing the stored entry entirely when the previous value was nullish. The value returned by the setter is now persisted directly. - 673347c: Fixed a build failure in `messageSync` and `wsSync`: their `url` parameter's default value (`globalThis.location?.href`) lacked an explicit type annotation, which `--isolatedDeclarations` (used by the package's `.d.ts` generation) requires on any parameter whose type can't be trivially inferred. No behavior or API changes — `url` is still `string | undefined`. - 790b4de: `multiplexStorage`: with asynchronous storages, `getItem`/`key` now resolve to the first storage (in order) that returns a value instead of whichever storage answers first, so a fast storage without a value no longer hides a slower one that has it. A rejecting storage is skipped; the first rejection is only rethrown if no storage returns a value. (#799) - 2dfa8d5: Return an explicit disposer as the fourth value from `makePersisted` to unsubscribe sync listeners and cancel pending initialization. Preserve writes made before deferred initialization. - 8226cf9: fix: hydration mismatch - Updated dependencies [89c5324] - Updated dependencies [5fc4efa] - Updated dependencies [4a5bf32] - Updated dependencies [dd165cd] - Updated dependencies [7ee755d] - Updated dependencies [50e36c9] - Updated dependencies [c98cb2d] - Updated dependencies [1b703e1] - Updated dependencies [638c530] - Updated dependencies [04a170e] - Updated dependencies [b7ef2f3] - Updated dependencies [5c23fda] - @solid-primitives/utils@7.0.0 ## 5.0.0-next.8 ### Minor Changes - 790b4de: Add a `merge` option to `makePersisted` that applies stored data on top of the initial value instead of replacing it, so keys added to a store's initial value later keep their defaults when older persisted data is loaded (#748). `merge: true` deep-merges plain objects (arrays and other values are replaced); a function `(stored, initial) => value` allows custom merging. Default behavior is unchanged. If the initial value is still pending (an async or optimistic signal), there are no defaults yet: `merge: true` uses the stored data as is, and a custom merge function receives `undefined` as the initial value. ### Patch Changes - 790b4de: `multiplexStorage`: with asynchronous storages, `getItem`/`key` now resolve to the first storage (in order) that returns a value instead of whichever storage answers first, so a fast storage without a value no longer hides a slower one that has it. A rejecting storage is skipped; the first rejection is only rethrown if no storage returns a value. (#799) ## 5.0.0-next.7 ### Patch Changes - 2dfa8d5: Return an explicit disposer as the fourth value from `makePersisted` to unsubscribe sync listeners and cancel pending initialization. Preserve writes made before deferred initialization. ## 5.0.0-next.6 ### Patch Changes - 1b703e1: Bump the `solid-js`/`@solidjs/web`/`@solidjs/signals` peer and dev dependency range to `2.0.0-rc.14`. - Updated dependencies [1b703e1] - @solid-primitives/utils@7.0.0-next.6 ## 5.0.0-next.5 ### Patch Changes - 638c530: Bump the `solid-js`/`@solidjs/web`/`@solidjs/signals` peer and dev dependency range to `2.0.0-rc.9`, and `babel-preset-solid` to `2.0.0-rc.2`. Two behavior fixes were needed to keep up with upstream changes in this range: - `@solid-primitives/deep`: `captureStoreUpdates` no longer missed property changes. As of `2.0.0-rc.1` a store's `[$TRACK]` only fires for structural changes (key additions/removals), so leaf value changes stopped being reported. Each node's direct property values are now tracked individually. Updates are still reported at the shallowest node that actually changed. - `@solid-primitives/storage`: `makePersisted` no longer persists stale data. Signal writes stay pending until the next flush in `2.0.0-rc.1`+, so reading the value back inside the setter returned the _previous_ one — persisting stale data, or removing the stored entry entirely when the previous value was nullish. The value returned by the setter is now persisted directly. - Updated dependencies [7ee755d] - Updated dependencies [638c530] - @solid-primitives/utils@7.0.0-next.5 ## 5.0.0-next.4 ### Patch Changes - Bump the `solid-js`/`@solidjs/web`/`@solidjs/signals`/`babel-preset-solid` peer and dev dependency range to `2.0.0-rc.0`. No API or behavior changes on our end — this tracks upstream's move from the beta series into the release candidate. - Updated dependencies - @solid-primitives/utils@7.0.0-next.4 ## 5.0.0-next.3 ### Patch Changes - 673347c: Fixed a build failure in `messageSync` and `wsSync`: their `url` parameter's default value (`globalThis.location?.href`) lacked an explicit type annotation, which `--isolatedDeclarations` (used by the package's `.d.ts` generation) requires on any parameter whose type can't be trivially inferred. No behavior or API changes — `url` is still `string | undefined`. ## 5.0.0-next.2 ### Patch Changes - 99b7631: sync API: allow for url specification ## 5.0.0-next.1 ### Patch Changes - 50e36c9: Bump the `solid-js`/`@solidjs/web` peer and dev dependency range to `2.0.0-beta.20`. No API or behavior changes; beta.19/beta.20 introduced no breaking changes upstream (internal tree-shaking work, a new `solid-js/refresh` HMR entry point, and SSR/hydration/`lazy()` bug fixes). - 8226cf9: fix: hydration mismatch - Updated dependencies [50e36c9] - @solid-primitives/utils@7.0.0-next.2 ## 5.0.0-next.0 ### Major Changes - 9404090: **`makePersisted`** - simplify setter, Solid 2.0 adaption, simpler types using function overloads ### Patch Changes - Updated dependencies [89c5324] - Updated dependencies [4a5bf32] - @solid-primitives/utils@7.0.0-next.0 ## 4.3.4 ### Patch Changes - Updated dependencies [6680ab9] - @solid-primitives/utils@6.4.0 ## 4.3.3 ### Patch Changes - 396812d: Enable verbatimModuleSyntax -> add `type` keyword to all type imports. - Updated dependencies [396812d] - @solid-primitives/utils@6.3.2 ## 4.3.2 ### Patch Changes - 53f08cc: fix: Move `"@solid-primitives/source"` export condition under import in package.json (Fixes #774, Fixes #749) - Updated dependencies [53f08cc] - @solid-primitives/utils@6.3.1 ## 4.3.1 ### Patch Changes - e2e290e: Correct package.json exports. ## 4.3.0 ### Minor Changes - ea09f71: Remove CJS support. The package is ESM only now. ### Patch Changes - Updated dependencies [ea09f71] - @solid-primitives/utils@6.3.0 ## 4.2.1 ### Patch Changes - 7e50e35: Fix `makePersisted` type narrowing ## 4.2.0 ### Minor Changes - 89117a6: storage: expose init promise/value, resource: docs clarification ## 4.1.0 ### Minor Changes - fd4e161: fixes utf8 escaping in cookieStorage ## 4.0.0 ### Major Changes - 94d1bcc: storage: remove deprecated primitives, simplify types, add makeObjectStorage ## 3.8.0 ### Minor Changes - b9d7b28: fix ssr handling ## 3.7.1 ### Patch Changes - bebccc1: Set-Cookie header will be sent with trailing `, ` in some cases which prefixes the name in the browser too Don't append false boolean values from `cookieOptions` Stability improvements: ignore unexpected `cookieOption` keys ## 3.7.0 ### Minor Changes - 4ec7533: storage: fix exports ## 3.6.0 ### Minor Changes - bb4fc57: move tauri storage to submodule - 1382d8f: fix cookie serialization ## 3.5.0 ### Minor Changes - 72db58b: type fixes for makePersisted ## 3.4.0 ### Minor Changes - 5d89290: add tauriStorage ## 3.3.0 ### Minor Changes - 99c6e09: Add back the return statement to withOptions ## 3.2.0 ### Minor Changes - 40380a2: safe sync deserialization - 407a630: Bugfix for newly introduced sync api. Now BroadcastChannel for `messageSync` should also work as expected. - c5145af: fix withOptions ## 3.1.0 ### Minor Changes - 713cac6: add forgotten withOptions method to cookieStorage ## 3.0.0 ### Major Changes - bf7605c: storage: new sync API, multiplexing, cookieStorage fixes, withOptions ## 2.1.4 ### Patch Changes - 74db287: Correct the "homepage" field in package.json ## 2.1.3 ### Patch Changes - Updated dependencies [48d44c0] - @solid-primitives/utils@6.2.3 ## 2.1.2 ### Patch Changes - d23dd74: Add type exports for cjs - Updated dependencies [d23dd74] - @solid-primitives/utils@6.2.2 ## 2.1.1 ### Patch Changes - a5f01c30: Loosen solid-start peer dependency ## 2.1.0 ### Minor Changes - 92041fd3: allow providing request getter / cookie setter on the server ### Patch Changes - Updated dependencies [92c1e5c4] - @solid-primitives/utils@6.2.1 ## 2.0.0 ### Major Changes - d0453ccf: new makePersisted primitive, deprecated old API ## 1.3.11 ### Patch Changes - Updated dependencies [3c007b92] - @solid-primitives/utils@6.2.0 ## 1.3.10 ### Patch Changes - Updated dependencies [2e0bcedf] - @solid-primitives/utils@6.1.1 ## 1.3.9 ### Patch Changes - Updated dependencies [2f6d3732] - @solid-primitives/utils@6.0.0 ## 1.3.8 ### Patch Changes - 3fad3789: Revert from publishing separate server, development, and production builds that has to rely on export conditions to publishing a single build that can be used in any environment. Envs will be checked at with `isDev`and `isServer` consts exported by `"solid-js/web"` so it's still tree-shakeable. - Updated dependencies [3fad3789] - @solid-primitives/utils@5.5.1 ## 1.3.7 ### Patch Changes - Updated dependencies [d6559a32] - @solid-primitives/utils@5.4.0 ## 1.3.7-beta.0 ### Patch Changes - Updated dependencies [d6559a32] - @solid-primitives/utils@5.4.0-beta.0 ## 1.3.6 ### Patch Changes - 865d5ee9: Fix build. (remove keepNames option) - Updated dependencies [865d5ee9] - @solid-primitives/utils@5.2.1 ## 1.3.5 ### Patch Changes - 51e80d27: Fix: hydration issue ## 1.3.4 ### Patch Changes - dd2d7d1c: Improve export conditions. ## 1.3.3 ### Patch Changes - b662fe9f: Improve package export contidions for SSR (node, workers, deno) ## 1.3.2 ### Patch Changes - 7ac41ed: Update to solid-js version 1.5 ## Changelog up to version 1.3.1 0.0.100 Initial release 1.0.0 First proper release of storage engine with CJS support. 1.0.7 Patch CJS support. 1.0.10 Minor patch fixed missing types. 1.1.0 Updated to Solid 1.3 1.1.1 Patched peerDependency issue 1.1.2 Added sync option to disable event synching