diff --git a/examples/qwik-ts/src/hooks/use-service.ts b/examples/qwik-ts/src/hooks/use-service.ts index ed30ad78e1..b63ff32bde 100644 --- a/examples/qwik-ts/src/hooks/use-service.ts +++ b/examples/qwik-ts/src/hooks/use-service.ts @@ -1,4 +1,4 @@ -import { NoSerialize, noSerialize, useComputed$, useStore, useVisibleTask$ } from "@builder.io/qwik" +import { NoSerialize, noSerialize, useSignal, useVisibleTask$ } from "@builder.io/qwik" import type { Machine, StateMachine as S } from "@zag-js/core" interface UseServiceOptions< @@ -18,11 +18,7 @@ export function useService< const { qrl, initialState } = props const { state: hydratedState, context } = options ?? {} - const store = useStore<{ - service: NoSerialize> | null - }>({ - service: null, - }) + const serviceSignal = useSignal> | null>(null) useVisibleTask$(async ({ track, cleanup }) => { // Load the service @@ -35,12 +31,13 @@ export function useService< service!.start(hydratedState ?? initialState) - store.service = noSerialize(service) + serviceSignal.value = noSerialize(service) + // store.service = noSerialize(service) cleanup(() => { service!.stop() }) }) - return useComputed$(() => store.service) + return serviceSignal } diff --git a/examples/qwik-ts/src/hooks/use-snapshot.ts b/examples/qwik-ts/src/hooks/use-snapshot.ts index b04fe329b4..54af9fa709 100644 --- a/examples/qwik-ts/src/hooks/use-snapshot.ts +++ b/examples/qwik-ts/src/hooks/use-snapshot.ts @@ -1,4 +1,4 @@ -import { NoSerialize, noSerialize, Signal, useComputed$, useSignal, useVisibleTask$ } from "@builder.io/qwik" +import { NoSerialize, noSerialize, Signal, useSignal, useVisibleTask$ } from "@builder.io/qwik" import type { Machine, StateMachine as S } from "@zag-js/core" export function useSnapshot< @@ -33,5 +33,5 @@ export function useSnapshot< }) }) - return useComputed$(() => stateSignal.value) + return stateSignal }