Improve AI docs
Lint / lint (push) Successful in 27s

This commit is contained in:
Julien Valverdé
2026-08-24 03:05:21 +02:00
parent 01e62b7ae7
commit 60e27bb80f
5 changed files with 1 additions and 27 deletions
-3
View File
@@ -36,9 +36,6 @@ When writing effect-view code, use the actual current source and tests in `src/`
**Small utilities**:
- bridging React-tracked values into an Effect `PubSub` → [PubSub.md](./ai-docs/PubSub.md)
- consuming a raw Effect `Stream` as React state → [Stream.md](./ai-docs/Stream.md)
- resolving a `React.SetStateAction` against a previous value → [SetStateAction.md](./ai-docs/SetStateAction.md)
**Building dev tooling for effect-view itself** (not application code) → [ScopeRegistry.md](./ai-docs/ScopeRegistry.md) (component scope bookkeeping), [Refreshable.md](./ai-docs/Refreshable.md) (hot-reload integration)
## Choosing between async integrations
@@ -1,7 +0,0 @@
# Refreshable
**Low-level module for development-server integrations** (e.g. `@effect-view/vite-plugin`'s hot-reload support). Not used directly in application code.
`Refreshable.attach(component, cell)` connects a `Component` descriptor to a mutable "refresh cell" (`Refreshable.makeCell(component, signature, forceReset)`) that a dev-server integration updates as source files change. The attached component renders through a stable wrapper that swaps in the cell's current implementation on each update, using `React.useSyncExternalStore` to trigger a re-render and, when `signature` changes or `forceReset` is set, remounting the component (via a changed `key`) to discard React state that can no longer be trusted to match the new code.
If you are writing a bundler/dev-server integration for effect-view, this is the API to build on. Otherwise, ignore this module.
@@ -1,7 +0,0 @@
# ScopeRegistry
**Internal module — not part of the application-facing API.** Do not use this directly in application code; it exists to support `Component`'s lifecycle hooks (`Component.useScope` and everything built on it).
`ScopeRegistry` is an Effect service (auto-provided by `ReactRuntime.make` via `ReactRuntime.preludeLayer`) that tracks the `Scope.Scope` associated with each mounted component instance: `register` creates one, `commit` marks it as "React has committed this render" (cancelling its abandonment timeout), and `release` schedules it for closure after `finalizerExecutionDebounce` once the owning component/dependency-set unmounts. A background loop closes scopes whose debounce has elapsed and force-closes any scope left uncommitted past `scopeCommitTimeout` (guards against an abandoned render, e.g. one thrown away by React Strict Mode or a Suspense retry).
Relevant only if you're building low-level tooling around effect-view's rendering internals.
@@ -1,9 +0,0 @@
# SetStateAction
A single helper for resolving React's `SetStateAction<S>` (`S | ((prev: S) => S)`) against a previous value — the same logic `React.useState`'s setter applies internally.
```ts
SetStateAction.value(setStateAction, prevState) // dual API, also curried: SetStateAction.value(prevState)(setStateAction)
```
Used internally by `Lens.useState` to support functional updates (`setValue(prev => prev + 1)`); rarely needed directly in application code unless you're building a custom hook that accepts a `React.SetStateAction<S>`.
+1 -1
View File
@@ -63,7 +63,7 @@ const [name, setName] = yield* Lens.useState(state.name)
<input value={name} onChange={e => setName(e.currentTarget.value)} />
```
Calling the setter writes through the `Lens`, so every other subscriber (another `Lens.useState`, or a `View.useAll` elsewhere) sees the update. `Lens.useState(lens, { equivalence? })` controls when a change triggers a re-render. The setter accepts a plain value or a `prev => next` updater, resolved internally by `SetStateAction.value` (see `SetStateAction.md`).
Calling the setter writes through the `Lens`, so every other subscriber (another `Lens.useState`, or a `View.useAll` elsewhere) sees the update. `Lens.useState(lens, { equivalence? })` controls when a change triggers a re-render. The setter accepts a plain value or a `prev => next` updater, same as `React.useState`'s.
## Focused Lenses