Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: colors syncing issue (#157)

thecodrr0f89ae1af620
diff --git a/apps/web/src/app.js b/apps/web/src/app.js
index e3e69fc05..dbcc3816f 100644
--- a/apps/web/src/app.js
+++ b/apps/web/src/app.js
@@ -9,7 +9,6 @@ import { useStore as useUserStore } from "./stores/user-store";
import { useStore as useNotesStore } from "./stores/note-store";
import Animated from "./components/animated";
import NavigationMenu from "./components/navigationmenu";
-import { db } from "./common";
import { useRoutes } from "hookrouter";
import routes from "./navigation/routes";
import Editor from "./components/editor";
diff --git a/apps/web/src/components/navigation-menu/index.js b/apps/web/src/components/navigation-menu/index.js
index 3826f3079..dc49fae14 100644
--- a/apps/web/src/components/navigation-menu/index.js
+++ b/apps/web/src/components/navigation-menu/index.js
@@ -48,7 +48,7 @@ function NavigationMenu(props) {
const toggleSideMenu = useAppStore((store) => store.toggleSideMenu);
const isSyncing = useUserStore((store) => store.isSyncing);
const isLoggedIn = useUserStore((store) => store.isLoggedIn);
- const logout = useUserStore((store) => store.logout);
+ //const logout = useUserStore((store) => store.logout);
const sync = useUserStore((store) => store.sync);
const theme = useThemeStore((store) => store.theme);
const toggleNightMode = useThemeStore((store) => store.toggleNightMode);
diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.js
index 1f5873518..8e6cd00fd 100644
--- a/apps/web/src/stores/note-store.js
+++ b/apps/web/src/stores/note-store.js
@@ -1,6 +1,7 @@
import { db, notesFromContext } from "../common/index";
import createStore from "../common/store";
import { store as editorStore } from "./editor-store";
+import { store as appStore } from "./app-store";
import Vault from "../common/vault";
import BaseStore from ".";
import { EV } from "notes-core/common";
@@ -102,22 +103,10 @@ class NoteStore extends BaseStore {
} else {
await note.color(color);
}
- this._setValue(id, "colors", db.notes.note(id).data.colors);
- };
-
- /**
- * @private
- */
- _setValue = (noteId, prop, value) => {
- this.set((state) => {
- const { context, notes } = state;
- const arr = !context ? notes : context.notes;
- let index = arr.findIndex((note) => note.id === noteId);
- if (index < 0) return;
-
- arr[index][prop] = value;
- this._syncEditor(noteId, prop, value);
- });
+ if (!this._syncEditor(note.id, "colors", db.notes.note(id).data.colors)) {
+ this.refresh();
+ appStore.refreshColors();
+ }
};
/**