Open-source and local-first Slack and Notion alternative that puts you in control of your data
TypeScript chatchat-applicationcrdteditorelectronknowledge-baselocal-firstnotionnotion-alternativerealtime-collaborationself-hostedslacksqliteteam-collaborationwikiyjs
Include tanstack query options in useQuery hook
Hakan Shehu1ffde823cb6b
diff --git a/apps/desktop/src/renderer/hooks/use-query.tsx b/apps/desktop/src/renderer/hooks/use-query.tsxindex 8c974d88..73f9b29b 100644--- a/apps/desktop/src/renderer/hooks/use-query.tsx+++ b/apps/desktop/src/renderer/hooks/use-query.tsx@@ -1,14 +1,26 @@-import { QueryInput } from '@/shared/queries';+import { QueryInput, QueryMap } from '@/shared/queries';import { sha256 } from 'js-sha256';-import { useQuery as useTanstackQuery } from '@tanstack/react-query';+import {+ useQuery as useTanstackQuery,+ UseQueryOptions as TanstackUseQueryOptions,+} from '@tanstack/react-query';-export const useQuery = <T extends QueryInput>(input: T) => {+type UseQueryOptions<T extends QueryInput> = Omit<+ TanstackUseQueryOptions<QueryMap[T['type']]['output']>,+ 'queryFn' | 'queryKey'+>;++export const useQuery = <T extends QueryInput>(+ input: T,+ options?: UseQueryOptions<T>+) => {const inputJson = JSON.stringify(input);const hash = sha256(inputJson);const { data, isPending } = useTanstackQuery({queryKey: [hash],queryFn: () => window.colanode.executeQueryAndSubscribe(hash, input),+ ...options,});return {