diff --git a/tauri-app/src/lib/components/icon/Refresh.svelte b/tauri-app/src/lib/components/icon/Refresh.svelte deleted file mode 100644 index cea09e464..000000000 --- a/tauri-app/src/lib/components/icon/Refresh.svelte +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - diff --git a/tauri-app/src/lib/components/modal/ModalQuoteDebug.svelte b/tauri-app/src/lib/components/modal/ModalQuoteDebug.svelte index 4da4df858..ce3f18b6e 100644 --- a/tauri-app/src/lib/components/modal/ModalQuoteDebug.svelte +++ b/tauri-app/src/lib/components/modal/ModalQuoteDebug.svelte @@ -5,7 +5,7 @@ import { createQuery } from '@tanstack/svelte-query'; import { Alert, Modal } from 'flowbite-svelte'; import { type Hex } from 'viem'; - import {Refresh} from '@rainlanguage/ui-components'; + import { Refresh } from '@rainlanguage/ui-components'; import EvalResultsTable from '../debug/EvalResultsTable.svelte'; import { fade } from 'svelte/transition'; diff --git a/tauri-app/src/lib/mocks/queries.ts b/tauri-app/src/lib/mocks/queries.ts deleted file mode 100644 index 2887c8b8d..000000000 --- a/tauri-app/src/lib/mocks/queries.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { QueryClient, createInfiniteQuery, createQuery } from '@tanstack/svelte-query'; - -// A helper function to create a resolvable mock query. -// This gives us more control over when each query resolves. -export const createResolvableMockQuery = (queryFn: (() => T) | ((pageParam: number) => T)) => { - const resolveQueue: Array<() => void> = []; - let currentPromise: Promise; - - const createNewPromise = () => { - currentPromise = new Promise((res) => { - resolveQueue.push(res); - }); - }; - - createNewPromise(); // Initialize the first promise - - const resolvableQuery = async (pageParam?: number) => { - const mockData = queryFn(pageParam as number); - await currentPromise; - createNewPromise(); // Create a new promise for the next call - return mockData; - }; - - const resolve = () => { - const resolver = resolveQueue.shift(); - if (resolver) { - resolver(); - } - }; - - return { queryFn: resolvableQuery, resolve }; -}; - -// A helper function to create an infinite Tanstack query that resolves when you call -// the `resolve` function. -export const createResolvableInfiniteQuery = ( - _queryFn: (pageParam: number) => unknown, - getNextPageParam: ( - _lastPage: unknown, - _allPages: unknown[], - lastPageParam: number, - ) => number | undefined = (_lastPage: unknown, _allPages: unknown[], lastPageParam: number) => - lastPageParam + 1, -) => { - const { queryFn, resolve } = createResolvableMockQuery(_queryFn); - - const query = createInfiniteQuery( - { - queryKey: [], - queryFn: ({ pageParam }) => { - return queryFn(pageParam); - }, - initialPageParam: 0, - getNextPageParam, - }, - new QueryClient({ - defaultOptions: { - queries: { - staleTime: Infinity, - }, - }, - }), - ); - - return { query, resolve }; -}; - -// A helper function to create a regular Tanstack query that resolves when you call resolve -export const createResolvableQuery = (_queryFn: () => T) => { - const { queryFn, resolve } = createResolvableMockQuery(_queryFn); - - const query = createQuery( - { - queryKey: [], - queryFn: () => { - return queryFn(); - }, - }, - new QueryClient({ - defaultOptions: { - queries: { - staleTime: Infinity, - }, - }, - }), - ); - - return { query, resolve }; -};