Closed victor-gapeev closed 2 months ago
Hi, i got next bug with last @preact-signals/query version:
My custom hook to wrap Read entity queries:
export default function useREntity<E, Q>(prefix: EntityList, query: Partial<Q> = {}) { const router = useLocation() const { logout } = useUser() const path = `/${prefix}` const q = useQuery$(() => ({ queryFn: async ({ signal }) => { if (!signal?.aborted) { const response = await getRequest<E, Q>(path, query, signal) return response } }, queryKey: [prefix, ...Object.values(query).map((q) => q + "")], })) if (q.data && !q.data.result) { if (q.data.code == 401) { logout() router.route("/login") } } return q }
Error in preact code:
I also use the preact-iso package to create spa routing.
Update: This bug happens only after the first load, if I switch pages and return back, I can use filters and other parts, and everything works fine.
It's a strange behavior. I will investigate it
Im sorry, its my fault. Above in my code I accidentally store useSignal result in global variables, which leads to strange bugs like this.
Hi, i got next bug with last @preact-signals/query version:
My custom hook to wrap Read entity queries:
Error in preact code:
I also use the preact-iso package to create spa routing.
Update: This bug happens only after the first load, if I switch pages and return back, I can use filters and other parts, and everything works fine.