Fix
All checks were successful
Lint / lint (push) Successful in 11s

This commit is contained in:
Julien Valverdé
2025-07-28 04:32:08 +02:00
parent 55ca8a0dd4
commit ec8f9f2ddb
5 changed files with 16 additions and 12 deletions

View File

@@ -2,7 +2,8 @@ import * as Domain from "@/domain"
import { Box, Button, Flex, IconButton, TextArea } from "@radix-ui/themes"
import { GetRandomValues, makeUuid4 } from "@typed/id"
import { Chunk, Effect, Match, Option, Ref, Runtime, SubscriptionRef } from "effect"
import { Component, Hook, Memoized } from "effect-fc"
import { Component, Memoized } from "effect-fc"
import { Hooks } from "effect-fc/hooks"
import { SubscriptionSubRef } from "effect-fc/types"
import { FaArrowDown, FaArrowUp } from "react-icons/fa"
import { FaDeleteLeft } from "react-icons/fa6"
@@ -28,7 +29,7 @@ export class Todo extends Component.make(function* Todo(props: TodoProps) {
const runtime = yield* Effect.runtime()
const state = yield* TodosState
const [ref, contentRef] = yield* Hook.useMemo(() => Match.value(props).pipe(
const [ref, contentRef] = yield* Hooks.useMemo(() => Match.value(props).pipe(
Match.tag("new", () => Effect.andThen(makeTodo, SubscriptionRef.make)),
Match.tag("edit", ({ index }) => Effect.succeed(SubscriptionSubRef.makeFromChunkRef(state.ref, index))),
Match.exhaustive,
@@ -39,7 +40,7 @@ export class Todo extends Component.make(function* Todo(props: TodoProps) {
] as const),
), [props._tag, props.index])
const [content, size] = yield* Hook.useSubscribeRefs(contentRef, state.sizeRef)
const [content, size] = yield* Hooks.useSubscribeRefs(contentRef, state.sizeRef)
return (
<Flex direction="column" align="stretch" gap="2">

View File

@@ -1,15 +1,16 @@
import { Container, Flex, Heading } from "@radix-ui/themes"
import { Chunk, Console, Effect } from "effect"
import { Component, Hook } from "effect-fc"
import { Component } from "effect-fc"
import { Hooks } from "effect-fc/hooks"
import { Todo } from "./Todo"
import { TodosState } from "./TodosState.service"
export class Todos extends Component.make(function* Todos() {
const state = yield* TodosState
const [todos] = yield* Hook.useSubscribeRefs(state.ref)
const [todos] = yield* Hooks.useSubscribeRefs(state.ref)
yield* Hook.useOnce(() => Effect.andThen(
yield* Hooks.useOnce(() => Effect.andThen(
Console.log("Todos mounted"),
Effect.addFinalizer(() => Console.log("Todos unmounted")),
))