major overhaul (not finished)

This commit is contained in:
Ren Amamiya
2023-03-22 09:22:34 +07:00
parent 3c3ee2fc88
commit 49b7ebf32b
17 changed files with 150 additions and 68 deletions

View File

@@ -1,3 +1,14 @@
import { atom } from 'jotai';
import { atomsWithQuery } from 'jotai-tanstack-query';
import Database from 'tauri-plugin-sql-api';
export const atomHasNewerNote = atom(false);
// usecase: notify user that connector has receive newer note
export const hasNewerNoteAtom = atom(false);
// usecase: get all notes (limit 1000)
export const [initialNotesAtom] = atomsWithQuery(() => ({
queryFn: async () => {
const db = await Database.load('sqlite:lume.db');
const result = await db.select(`SELECT * FROM cache_notes ORDER BY created_at DESC LIMIT 1000`);
return result;
},
}));