fixed duplicate note in newsfeed and minor fixes

This commit is contained in:
Ren Amamiya
2023-04-16 08:31:40 +07:00
parent 66e45937de
commit b778cf6198
10 changed files with 51 additions and 43 deletions

View File

@@ -1,7 +1,15 @@
import { atom } from 'jotai';
import { atomWithReset } from 'jotai/utils';
// notes
export const notesAtom = atom([]);
export const filteredNotesAtom = atom((get) => {
const notes = get(notesAtom);
return notes.filter((item, index) => index === notes.findIndex((other) => item.parent_id === other.parent_id));
});
// note content
export const noteContentAtom = atomWithReset('');
// notify user that connector has receive newer note
export const hasNewerNoteAtom = atom(false);