solid-core · diff
git:20260315.284738e to git:20260904.1edb1e3
15 added, 26 removed. Audit A to A.
What this update changes in the checks
No check changed: every fixed check gives the same answer before and after this update.
A tripped check is a label, not a verdict: read the matched text and the lines below. This week's updates that newly trip a check.
---
description: Solid core runtime — component model, flow controls, context, and hydration
globs: packages/solid/**
alwaysApply: false
---
# Solid Core (`solid-js`)
## Package Role
- Wraps `@solidjs/signals` with a UI component layer. Re-exports all reactivity primitives directly (no wrapping) and adds: components, context, flow controls, hydration, and JSX types.
+ Wraps `@solidjs/signals` with a UI component layer. Re-exports reactivity primitives and adds: components, context, flow controls, hydration, and JSX types.
- ## Entry Point (`src/index.ts`)
+ ## Dual Runtime
- - Re-exports everything from `@solidjs/signals`
- - Exports component utilities from `client/component.js`
- - Exports context/children from `client/core.js`
- - Exports flow components from `client/flow.js`
- - Exports `sharedConfig`, `Loading` from `client/hydration.js`
- - Exports `tryCatch`, `reducer` from `utilities.js`
- - Dev mode: detects multiple instances via `globalThis.Solid$$`
+ Two parallel runtimes selected by conditional exports — keep them in sync when touching either:
+ - **`src/client/`** — browser runtime. `src/index.ts` re-exports signals primitives from `@solidjs/signals`, component utilities (`export *` from `client/component.js` and `client/flow.js`), context/children from `client/core.js`, hydration facades from `client/hydration.js`, plus no-op SSR stubs (`ssrHandleError`, `ssrScope`, `runInServerComponentScope`) and the dev-only `DEV` object.
+ - **`src/server/`** — full server mirror (`component.ts`, `core.ts`, `flow.ts`, `hydration.ts`, `signals.ts`, `shared.ts`): mock signals facades and server implementations of the same surface. NOT empty — server-side store/signal typing changes must be applied here too (e.g. `server/signals.ts` carries the store facade types).
+
## Component Creation
- `createComponent(Comp, props)` wraps execution in `untrack()` — components never track during creation. Dev mode wraps with `devComponent()` which attaches `_props`, `_name`, `_component` to the owner for debugging.
+ `createComponent(Comp, props)` wraps execution in `untrack()` — components never track during creation. Dev mode wraps with `devComponent()` attaching `_props`, `_name`, `_component` to the owner.
- `lazy(fn)` returns a component that loads async via `createMemo`. Returns `""` while loading.
+ `lazy(fn, options?, moduleUrl?)` — supports `{ export }` for named exports; returns the component augmented with `.preload()` and `moduleUrl`. Loading rides async-memo semantics (NotReady suspension), not a sentinel return.
`createUniqueId()` is hydration-aware via `sharedConfig.getNextContextId()`.
## Context System
- `createContext(defaultValue)` creates a context with a Symbol ID. Providers use `createRoot()` for isolated scope. Storage uses `setContext`/`getContext` from `@solidjs/signals` (owner-based, not global).
-
- `children(fn)` resolves children via `createMemo` + `flatten()`, returns accessor with `.toArray()` helper.
+ `createContext(defaultValue)` creates a context with a Symbol ID. Storage uses `setContext`/`getContext` from `@solidjs/signals` (owner-based, not global). `children(fn)` resolves via `createMemo` + `flatten()`, returns accessor with `.toArray()`.
- ## Flow Controls
+ ## Flow Controls (`client/flow.ts`)
| Component | Backing Primitive | Key Behavior |
|-----------|------------------|--------------|
| `For<T>` | `mapArray()` | List rendering, supports `keyed` (boolean or key fn) |
| `Repeat` | `repeat()` | Count-based rendering with `from` offset |
| `Show<T>` | `createMemo` | Conditional, function children get narrowed accessor |
| `Switch/Match` | `children()` + memos | Sequential evaluation, short-circuit |
| `Errored` | `createErrorBoundary()` | Fallback: element or `(err, reset) => JSX.Element` |
- | `Boundary` | `createBoundary()` | Generic boundary with `mode` prop |
+ | `Loading` | `createLoadingBoundary()` | Async fallback boundary |
+ | `Reveal` | `createRevealOrder()` | Reveal-order coordination |
Function children in `Show`/`Match` have stale-read protection — accessing after unmount throws via `narrowedError()`.
- ## Hydration
-
- `sharedConfig` coordinates hydration state: `hydrating`, `resources`, `load`, `has`, `gather`, `registry`, `done`, `getNextContextId()`.
-
- `Loading` component uses `createLoadingBoundary()` normally. During hydration, it checks resources via `sharedConfig.has(id)` and `sharedConfig.load(id)`, managing promise resolution.
-
- ## Server Stubs
+ ## Hydration (`client/hydration.ts`)
- `src/server/index.ts` is empty. `ssrHandleError` and `ssrRunInScope` are no-op stubs in the client build.
+ `sharedConfig` coordinates hydration state (`hydrating`, resource registry, `getNextContextId()`); `enableHydration()` arms it. The module also exports hydration-aware facades that shadow signals primitives during hydration (`createMemo`, `createSignal`, `createErrorBoundary`, `createOptimistic`, store creators) — type changes to store/signal APIs must be mirrored in these facades.
## Naming Conventions
- Component types: PascalCase (`Component`, `FlowComponent`, `ParentComponent`)
- Functions: camelCase (`createComponent`, `createContext`, `useContext`)
- - Dev-only internal props: `_props`, `_name`, `_component`
- - Symbols: `$DEVCOMP` for component marking
+ - Dev-only internal props: `_props`, `_name`, `_component`; `$DEVCOMP` symbol marks components