v2.0.0-beta.0
Breaking Changes📦 solid-jsView on GitHub →
⚠ 4 breaking✨ 8 features🔧 9 symbols
Summary
Solid 2.0 enters the beta stage, introducing major architectural shifts like first-class async support, deterministic batching, and a rewritten signals implementation. This release includes several breaking changes related to control flow, effects, and DOM directives.
⚠️ Breaking Changes
- List rendering: `Index` is replaced by `<For keyed={false}>`, and `For` children now receive accessors (`item()` / `i()`) instead of direct values.
- Effects & lifecycle: `createEffect` is split into compute and apply stages. `onMount` is replaced by `onSettled`, which can now return a cleanup function.
- Stores: Setters are now draft-first by default. `storePath(...)` is introduced as an opt-in helper for users who prefer the old path-style ergonomics.
- DOM: `use:` directives are removed; users must switch to using `ref` directive factories (and arrays for composition).
Migration Steps
- Replace usage of `Index` with `<For keyed={false}>` and update children to use accessors like `item()` and `i()`.
- Replace `onMount` with `onSettled` and adapt cleanup logic if necessary.
- Review store setter usage; setters are now draft-first. Use `storePath(...)` if old path-style ergonomics are required.
- Remove all usages of `use:` directives and replace them with `ref` directive factories.
✨ New Features
- Async computations now first-class support for returning Promises or async iterables, allowing the graph to suspend/resume work.
- Introduction of `<Loading>` component for showing a fallback while a subtree is initializing, keeping UI stable during background work.
- `isPending(() => expr)` expression introduced to indicate when "refreshing..." work is in flight without tearing down existing UI.
- Mutations are centralized via `action(...)` combined with optimistic primitives (`createOptimistic`, `createOptimisticStore`) for coherent optimistic update flows.
- Derived state is now a primitive via function forms like `createSignal(fn)` and `createStore(fn)` for explicit and composable derived-but-writable patterns.
- A more predictable scheduler where updates are microtask-batched, and reads do not update until the batch flushes (use `flush()` explicitly for immediate settling).
- Dev warnings added to catch accidental "top-level reads" in components and writes in reactive scopes.
- DOM model cleanup: `classList` functionality is folded into `class`.