diff --git a/packages/example/src/routes/async.tsx b/packages/example/src/routes/async.tsx index a443dab..62e0234 100644 --- a/packages/example/src/routes/async.tsx +++ b/packages/example/src/routes/async.tsx @@ -1,5 +1,5 @@ import { HttpClient } from "@effect/platform" -import { Container, Flex, Heading, Slider, Text } from "@radix-ui/themes" +import { Container, Flex, Heading, Slider, Text, TextField } from "@radix-ui/themes" import { createFileRoute } from "@tanstack/react-router" import { Array, Effect, flow, Option, Schema } from "effect" import { Async, Component, Memoized } from "effect-fc" @@ -34,24 +34,31 @@ class AsyncFetchPostView extends Component.make("AsyncFetchPostView")(function*( ) }).pipe( Async.async, - Async.withOptions({ defaultFallback: Loading post... }), + Async.withOptions({ defaultFallback: Default fallback }), Memoized.memoized, ) {} const AsyncRouteComponent = Component.make("AsyncRouteView")(function*() { + const [text, setText] = React.useState("Typing here should not trigger a refetch of the post") const [id, setId] = React.useState(1) + const AsyncFetchPost = yield* AsyncFetchPostView.use return ( - + + setText(e.currentTarget.value)} + /> + - + Loading post...} /> )