GraphQL autocomplete and duplicate request

This commit is contained in:
Gregory Schier
2023-03-21 23:54:45 -07:00
parent abc60667c6
commit c7738743c5
31 changed files with 299 additions and 157 deletions

View File

@@ -1,6 +1,5 @@
import { invoke } from '@tauri-apps/api';
import type { Workspace } from '../lib/models';
import { convertDates } from '../lib/models';
import { useQuery } from '@tanstack/react-query';
export function workspacesQueryKey() {
@@ -10,8 +9,7 @@ export function workspacesQueryKey() {
export function useWorkspaces() {
return (
useQuery(workspacesQueryKey(), async () => {
const workspaces = (await invoke('workspaces')) as Workspace[];
return workspaces.map(convertDates);
return (await invoke('workspaces')) as Workspace[];
}).data ?? []
);
}