Clean up model fetching and loading states

This commit is contained in:
Gregory Schier
2025-01-20 13:44:11 -08:00
parent 0453e84d38
commit 8ad7ac0bef
42 changed files with 180 additions and 247 deletions

View File

@@ -1,10 +1,9 @@
import { useFastMutation } from './useFastMutation';
import type { Environment } from '@yaakapp-internal/models';
import { useSetAtom } from 'jotai/index';
import { getEnvironment } from '../lib/store';
import { invokeCmd } from '../lib/tauri';
import { environmentsAtom } from './useEnvironments';
import {updateModelList} from "./useSyncModelStores";
import { environmentsAtom, getEnvironment } from './useEnvironments';
import { useFastMutation } from './useFastMutation';
import { updateModelList } from './useSyncModelStores';
export function useUpdateEnvironment(id: string | null) {
const setEnvironments = useSetAtom(environmentsAtom);
@@ -15,7 +14,7 @@ export function useUpdateEnvironment(id: string | null) {
>({
mutationKey: ['update_environment', id],
mutationFn: async (v) => {
const environment = await getEnvironment(id);
const environment = getEnvironment(id);
if (environment == null) {
throw new Error("Can't update a null environment");
}