## Summary - Add comprehensive AI-oriented documentation for effect-view components, state, async rendering, queries, mutations, forms, streams, and runtime setup. - Fix `Mutation.mutate` so each invocation consistently uses its own key instead of reusing the previous mutation key. - Improve Vite Fast Refresh instrumentation for: - User-defined component wrappers. - Data-first and pipeline-based `withContext`/`withRuntime` entrypoints. - Nested function handling. - Stable hook signatures that preserve state for non-hook-related edits. - Add regression tests for mutation keys and refresh behavior. - Bump `effect-view` to `0.1.5` and `@effect-view/vite-plugin` to `0.0.2`. ## Testing - `bun run --cwd packages/effect-view test -- src/Mutation.test.ts` - 4 tests passed - `bun run --cwd packages/vite-plugin test -- src/plugin.test.ts` - 11 tests passed The full test suite was not run. --------- Co-authored-by: Julien Valverdé <julien.valverde@mailo.com> Reviewed-on: #76
@effect-view/vite-plugin
Experimental Vite Fast Refresh support for Effect View components.
import { effectView } from "@effect-view/vite-plugin"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
export default defineConfig({
plugins: [
effectView(),
react(),
],
})
The plugin recognizes Component.make and Component.makeUntraced
definitions imported from effect-view. The legacy effect-fc package is
not supported. effect-view owns the bundler-neutral refresh cell protocol;
this package is the Vite adapter that retains those cells in HMR data. The
plugin assigns stable development IDs and self-accepts successfully
instrumented modules.
The adapter-facing protocol is exported from effect-view/Refreshable.
Renaming or removing an instrumented View invalidates the module upward instead of leaving a stale mounted descriptor.
React state is retained when the ordered hook signature is unchanged. Adding,
removing, or changing a hook call resets the Effect View implementation. Add
// @refresh reset to a module to reset its Views on every update.
Current limitations
- Definitions must be top-level variable, class, or default-export declarations.
- Hook signature analysis is conservative and based on
useXcall syntax. - Changing a descriptor's trait pipeline during a refresh is not guaranteed to preserve state.
- Source maps for the injected transform are not generated yet.