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
+5
View File
@@ -1,9 +1,14 @@
import type { Folder } from '@yaakapp-internal/models';
import { useAtomValue } from 'jotai';
import { atom } from 'jotai/index';
import { jotaiStore } from '../lib/jotai';
export const foldersAtom = atom<Folder[]>([]);
export function useFolders() {
return useAtomValue(foldersAtom);
}
export function getFolder(id: string | null) {
return jotaiStore.get(foldersAtom).find((v) => v.id === id) ?? null;
}