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,7 +1,7 @@
import { DatabaseContext } from '@components/contexts/database';
import { RelayContext } from '@components/contexts/relay';
import { atomHasNewerNote } from '@stores/note';
import { hasNewerNoteAtom } from '@stores/note';
import { dateToUnix, hoursAgo } from '@utils/getDate';
@@ -16,7 +16,7 @@ export const NoteConnector = memo(function NoteConnector() {
const [follows]: any = useLocalStorage('follows');
const [relays]: any = useLocalStorage('relays');
const setHasNewerNote = useSetAtom(atomHasNewerNote);
const setHasNewerNote = useSetAtom(hasNewerNoteAtom);
const [isOnline, setIsOnline] = useState(navigator.onLine);
const now = useRef(new Date());
@@ -25,7 +25,7 @@ export const NoteConnector = memo(function NoteConnector() {
// insert to local database
await db.execute(
'INSERT OR IGNORE INTO cache_notes (id, pubkey, created_at, kind, content, tags) VALUES (?, ?, ?, ?, ?, ?);',
[event.id, event.pubkey, event.created_at, event.kind, event.content, JSON.stringify(event.tags)]
[event.id, event.pubkey, event.created_at, event.kind, event.content, String(event.tags)]
);
},
[db]