This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { R } from "@/reffuse"
|
||||
import { createFileRoute } from "@tanstack/react-router"
|
||||
import { DateTime, Ref, Schedule, Stream } from "effect"
|
||||
import { DateTime, Effect, Ref, Schedule, Stream, SubscriptionRef } from "effect"
|
||||
|
||||
|
||||
const timeEverySecond = Stream.repeatEffectWithSchedule(
|
||||
@@ -15,7 +15,7 @@ export const Route = createFileRoute("/time")({
|
||||
|
||||
function Time() {
|
||||
|
||||
const timeRef = R.useRefFromEffect(DateTime.now)
|
||||
const timeRef = R.useMemo(DateTime.now.pipe(Effect.flatMap(SubscriptionRef.make)))
|
||||
R.useFork(Stream.runForEach(timeEverySecond, v => Ref.set(timeRef, v)), [timeRef])
|
||||
const [time] = R.useRefState(timeRef)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Todo } from "@/domain"
|
||||
import { Box, Button, Card, Flex, TextArea } from "@radix-ui/themes"
|
||||
import { Effect, Option } from "effect"
|
||||
import { Effect, Option, SubscriptionRef } from "effect"
|
||||
import { R } from "../reffuse"
|
||||
import { TodosState } from "../services"
|
||||
|
||||
@@ -17,7 +17,7 @@ export function VNewTodo() {
|
||||
}, true))
|
||||
)
|
||||
|
||||
const todoRef = R.useRefFromEffect(createEmptyTodo)
|
||||
const todoRef = R.useMemo(createEmptyTodo.pipe(Effect.flatMap(SubscriptionRef.make)))
|
||||
const [todo, setTodo] = R.useRefState(todoRef)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user