0.1.6 (#9)
Co-authored-by: Julien Valverdé <julien.valverde@mailo.com> Reviewed-on: https://gitea:3000/Thilawyn/reffuse/pulls/9
This commit was merged in pull request #9.
This commit is contained in:
@@ -11,41 +11,41 @@
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.23.0",
|
||||
"@tanstack/react-router": "^1.114.27",
|
||||
"@tanstack/react-router-devtools": "^1.114.27",
|
||||
"@tanstack/router-plugin": "^1.114.27",
|
||||
"@eslint/js": "^9.24.0",
|
||||
"@tanstack/react-router": "^1.115.3",
|
||||
"@tanstack/react-router-devtools": "^1.115.3",
|
||||
"@tanstack/router-plugin": "^1.115.3",
|
||||
"@thilawyn/thilaschema": "^0.1.4",
|
||||
"@types/react": "^19.0.12",
|
||||
"@types/react-dom": "^19.0.4",
|
||||
"@types/react": "^19.1.1",
|
||||
"@types/react-dom": "^19.1.2",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"eslint": "^9.23.0",
|
||||
"eslint": "^9.24.0",
|
||||
"eslint-plugin-react-hooks": "^5.2.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.19",
|
||||
"globals": "^16.0.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"typescript-eslint": "^8.28.0",
|
||||
"vite": "^6.2.3"
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"typescript-eslint": "^8.29.1",
|
||||
"vite": "^6.2.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"@effect/platform": "^0.80.1",
|
||||
"@effect/platform-browser": "^0.59.1",
|
||||
"@effect/platform": "^0.80.8",
|
||||
"@effect/platform-browser": "^0.59.8",
|
||||
"@radix-ui/themes": "^3.2.1",
|
||||
"@reffuse/extension-lazyref": "workspace:*",
|
||||
"@reffuse/extension-query": "workspace:*",
|
||||
"@typed/async-data": "^0.13.1",
|
||||
"@typed/id": "^0.17.1",
|
||||
"@typed/id": "^0.17.2",
|
||||
"@typed/lazy-ref": "^0.3.3",
|
||||
"effect": "^3.14.1",
|
||||
"lucide-react": "^0.483.0",
|
||||
"effect": "^3.14.8",
|
||||
"lucide-react": "^0.487.0",
|
||||
"mobx": "^6.13.7",
|
||||
"reffuse": "workspace:*"
|
||||
},
|
||||
"overrides": {
|
||||
"effect": "^3.14.1",
|
||||
"@effect/platform": "^0.80.1",
|
||||
"@effect/platform-browser": "^0.59.1",
|
||||
"effect": "^3.14.8",
|
||||
"@effect/platform": "^0.80.8",
|
||||
"@effect/platform-browser": "^0.59.8",
|
||||
"@typed/lazy-ref": "^0.3.3",
|
||||
"@typed/async-data": "^0.13.1"
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ function RouteComponent() {
|
||||
)
|
||||
})
|
||||
|
||||
const [state] = R.useRefState(mutation.state)
|
||||
const [state] = R.useSubscribeRefs(mutation.state)
|
||||
|
||||
|
||||
return (
|
||||
|
||||
@@ -31,7 +31,7 @@ function RouteComponent() {
|
||||
),
|
||||
})
|
||||
|
||||
const [state] = R.useRefState(query.state)
|
||||
const [state] = R.useSubscribeRefs(query.state)
|
||||
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { R } from "@/reffuse"
|
||||
import { Button, Flex } from "@radix-ui/themes"
|
||||
import { Button, Flex, Text } from "@radix-ui/themes"
|
||||
import { createFileRoute } from "@tanstack/react-router"
|
||||
import { GetRandomValues, makeUuid4 } from "@typed/id"
|
||||
import { Console, Effect, Stream } from "effect"
|
||||
import { useState } from "react"
|
||||
import { Console, Effect, Ref } from "effect"
|
||||
|
||||
|
||||
export const Route = createFileRoute("/tests")({
|
||||
@@ -22,9 +21,9 @@ function RouteComponent() {
|
||||
Effect.delay("1 second"),
|
||||
), [])
|
||||
|
||||
const [reactValue, setReactValue] = useState("initial")
|
||||
const reactValueStream = R.useStreamFromValues([reactValue])
|
||||
R.useFork(() => Stream.runForEach(reactValueStream, Console.log), [reactValueStream])
|
||||
|
||||
const uuidRef = R.useRef("none")
|
||||
const anotherRef = R.useRef(69)
|
||||
|
||||
|
||||
const logValue = R.useCallbackSync(Effect.fn(function*(value: string) {
|
||||
@@ -33,12 +32,16 @@ function RouteComponent() {
|
||||
|
||||
const generateUuid = R.useCallbackSync(() => makeUuid4.pipe(
|
||||
Effect.provide(GetRandomValues.CryptoRandom),
|
||||
Effect.map(setReactValue),
|
||||
Effect.flatMap(v => Ref.set(uuidRef, v)),
|
||||
), [])
|
||||
|
||||
|
||||
return (
|
||||
<Flex direction="row" justify="center" align="center" gap="2">
|
||||
<R.SubscribeRefs refs={[uuidRef, anotherRef]}>
|
||||
{(uuid, anotherRef) => <Text>{uuid} / {anotherRef}</Text>}
|
||||
</R.SubscribeRefs>
|
||||
|
||||
<Button onClick={() => logValue("test")}>Log value</Button>
|
||||
<Button onClick={() => generateUuid()}>Generate UUID</Button>
|
||||
</Flex>
|
||||
|
||||
Reference in New Issue
Block a user