import { Container, Flex, Heading, Slider, Text, TextField } from "@radix-ui/themes" import { createFileRoute } from "@tanstack/react-router" import { Console, Effect } from "effect" import { Async, Component, Memoized } from "effect-fc-next" import * as React from "react" import { runtime } from "@/runtime" const fetchPost = (id: number) => Effect.sleep("500 millis").pipe( Effect.as({ title: `Post ${id}`, body: `This is the content of post ${id}.`, }), ) interface AsyncFetchPostViewProps { readonly id: number } const AsyncFetchPostView = Component.make("AsyncFetchPostView")(function*( props: AsyncFetchPostViewProps, ) { yield* Component.useOnMount(() => Effect.gen(function*() { yield* Effect.addFinalizer(() => Console.log("AsyncFetchPostView unmounted")) yield* Console.log("AsyncFetchPostView mounted") })) const post = yield* Component.useOnChange( () => fetchPost(props.id), [props.id], ) return (