API update

This commit is contained in:
Julien Valverdé
2025-02-25 14:48:58 +01:00
parent 8754020323
commit 44de864713
8 changed files with 42 additions and 44 deletions

View File

@@ -18,7 +18,7 @@ export function VNewTodo() {
const runSync = R.useRunSync()
const todoRef = R.useMemo(createEmptyTodo.pipe(Effect.flatMap(SubscriptionRef.make)))
const todoRef = R.useMemo(() => createEmptyTodo.pipe(Effect.flatMap(SubscriptionRef.make)))
const [todo, setTodo] = R.useRefState(todoRef)

View File

@@ -9,13 +9,13 @@ import { VTodo } from "./VTodo"
export function VTodos() {
// Sync changes to the todos with the local storage
R.useFork(TodosState.TodosState.pipe(
R.useFork(() => TodosState.TodosState.pipe(
Effect.flatMap(state =>
Stream.runForEach(state.todos.changes, () => state.saveToLocalStorage)
)
))
const todosRef = R.useMemo(TodosState.TodosState.pipe(Effect.map(state => state.todos)))
const todosRef = R.useMemo(() => TodosState.TodosState.pipe(Effect.map(state => state.todos)))
const [todos] = R.useRefState(todosRef)