Skip to content

fix(store): initialize empty server stores - #4497

Open
clean99 wants to merge 1 commit into
solidjs:mainfrom
clean99:contrib/empty-server-store
Open

clean99 wants to merge 1 commit into
solidjs:mainfrom
clean99:contrib/empty-server-store

Conversation

@clean99

@clean99 clean99 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Summary

createStore() and createStore(undefined) start from an empty object in the browser, but on the server the state stays undefined, so the first partial update throws. The server createStore now defaults the initial state to a fresh object, like the client. Supplied objects and arrays keep their identity and update behavior.

How did you test this change?

  • Added packages/solid/test/server/store-default-state.spec.ts: 3 of its 5 tests fail without the change and all pass with it.
  • pnpm build and pnpm test pass (492 client and 23 server tests).
  • The built ESM and CommonJS store entries accept omitted, undefined and object initial values, then apply a partial update.
@changeset-bot

changeset-bot Bot commented Oct 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8464557

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

This PR includes changesets to release 2 packages
Name Type
solid-js Patch
test-integration Patch

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

@ryansolid ryansolid added the 1.x label Oct 31, 2026 — with Claude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants