@reffuse/extension-query 0.1.5 #16
@@ -15,6 +15,7 @@ export const Route = createFileRoute("/tests")({
|
|||||||
|
|
||||||
function RouteComponent() {
|
function RouteComponent() {
|
||||||
const runSync = R.useRunSync()
|
const runSync = R.useRunSync()
|
||||||
|
const runPromise = R.useRunPromise()
|
||||||
|
|
||||||
const [uuid, setUuid] = useState(R.useMemo(() => makeUuid, []))
|
const [uuid, setUuid] = useState(R.useMemo(() => makeUuid, []))
|
||||||
const generateUuid = R.useCallbackSync(() => makeUuid.pipe(
|
const generateUuid = R.useCallbackSync(() => makeUuid.pipe(
|
||||||
@@ -22,7 +23,7 @@ function RouteComponent() {
|
|||||||
), [])
|
), [])
|
||||||
|
|
||||||
const uuidStream = R.useStreamFromReactiveValues([uuid])
|
const uuidStream = R.useStreamFromReactiveValues([uuid])
|
||||||
const uuidStreamLatestValue = R.useSubscribeStream(uuidStream)
|
const [uuidStreamLatestValue, pullUuidStream] = R.usePullStream(uuidStream)
|
||||||
|
|
||||||
const scope = R.useScope([uuid])
|
const scope = R.useScope([uuid])
|
||||||
|
|
||||||
@@ -38,11 +39,11 @@ function RouteComponent() {
|
|||||||
<Button onClick={generateUuid}>Generate UUID</Button>
|
<Button onClick={generateUuid}>Generate UUID</Button>
|
||||||
<Text>
|
<Text>
|
||||||
{Option.match(uuidStreamLatestValue, {
|
{Option.match(uuidStreamLatestValue, {
|
||||||
onSome: v => v,
|
onSome: ([v]) => v,
|
||||||
onNone: () => <></>,
|
onNone: () => <></>,
|
||||||
})}
|
})}
|
||||||
</Text>
|
</Text>
|
||||||
{/* <Button onClick={() => runSync(pullUuidStream)}>Pull UUID</Button> */}
|
<Button onClick={() => runPromise(pullUuidStream)}>Pull UUID</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user