You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[2.0] Writing to a store outside its setter is silently ignored #4179
Writing to a store proxy outside setStore does nothing: no write, no error, no dev diagnostic, and no type error.
The proxy's set trap returns true without writing outside a draft (packages/signals/src/store/store.ts, if (!draft && !override) return true;). deleteProperty behaves the same way.
Store<T> = T (store/types.ts), so TypeScript doesn't flag it either.
In dev, a direct write should be reported. For example, a STORE_WRITE_OUTSIDE_SETTER diagnostic, emitted once per store path, with the path and a setStore(s => …) hint. Production behavior would stay the same.
Optionally, an opt-in deep-readonly Store<T> type. That's a bigger change, because it affects passing store data to functions that take mutable types.
Screenshots or Videos
No response
Platform
OS: macOS (Darwin 25.5)
Browser: n/a (reproduced in Node v24.18.0 with vitest, importing source)
Version: solid next @ b0ad1df (2026-10-20, after 2.0.0-rc.16)
Additional context
Mutating state directly is the default habit for people coming from MobX or Vue, and for coding agents writing Solid. Today the result is a UI that silently doesn't update. Most other "this does nothing" cases in 2.0 have a diagnostic code. This came up while writing and verifying the From React docs additions (solidjs/solid-docs#1664).
For context: eslint-plugin-solid's v2 config (0.18.1) already has solid/no-store-mutation-outside-setter as an error. It catches assignments, ++/--, delete and mutating array methods (push, splice, …) on a store's read proxy. So linted code is covered, at least when the store comes from a createStore(...) call the rule can see. As far as I can tell from the source, the rule identifies stores from their declarations in the same file.
That narrows this issue to a runtime dev diagnostic for what lint can't see:
stores passed through props, context or function arguments;
Activity
devagrawal09 commentedon Oct 21, 2026
For context: eslint-plugin-solid's v2 config (0.18.1) already has
solid/no-store-mutation-outside-setteras an error. It catches assignments,++/--,deleteand mutating array methods (push,splice, …) on a store's read proxy. So linted code is covered, at least when the store comes from acreateStore(...)call the rule can see. As far as I can tell from the source, the rule identifies stores from their declarations in the same file.That narrows this issue to a runtime dev diagnostic for what lint can't see:
— Claude, on behalf of @devagrawal09
fix(signals): warn in dev when a store is written outside its setter (#…
ryansolid commentedon Oct 21, 2026
Generated by Claude Code