A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
feat: speed up pin to menu
thecodrrd26f09a569d8
diff --git a/apps/web/src/stores/app-store.js b/apps/web/src/stores/app-store.jsindex 7f57b4cd7..95a84ae2c 100644--- a/apps/web/src/stores/app-store.js+++ b/apps/web/src/stores/app-store.js@@ -78,19 +78,22 @@ class AppStore extends BaseStore {pinItemToMenu = async (item) => {if (db.settings.isPinned(item.id)) {+ this.set((state) => {+ const index = state.menuPins.findIndex((i) => i.id === item.id);+ if (index >= -1) {+ state.menuPins.splice(index, 1);+ }+ });await db.settings.unpin(item.id);- await showToast(- "success",- `${toTitleCase(item.type)} unpinned from menu!`- );+ showToast("success", `${toTitleCase(item.type)} unpinned from menu!`);} else {+ this.set((state) => state.menuPins.push(item));await db.settings.pin(item.type, {id: item.id,notebookId: item.notebookId,});- await showToast("success", `${toTitleCase(item.type)} pinned to menu!`);+ showToast("success", `${toTitleCase(item.type)} pinned to menu!`);}- this.refreshMenuPins();// refresh the respective listswitch (item.type) {diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.jsindex aabda31ff..f78bcc7b3 100644--- a/apps/web/src/stores/editor-store.js+++ b/apps/web/src/stores/editor-store.js@@ -7,6 +7,7 @@ import BaseStore from ".";import { isMobile, isTablet } from "../utils/dimensions";import { getHashParam, setHashParam } from "../utils/useHashParam";import { qclone } from "qclone";+import { EV } from "notes-core/common";const SESSION_STATES = { stale: "stale", new: "new", locked: "locked" };const DEFAULT_SESSION = {@@ -44,6 +45,8 @@ class EditorStore extends BaseStore {if (note) await this.openSession(note);});++ EV.subscribe("user:loggedOut", () => this.clearSession());};openLastSession = () => {diff --git a/apps/web/yarn.lock b/apps/web/yarn.lockindex 3e2d1adff..ce0389fea 100644--- a/apps/web/yarn.lock+++ b/apps/web/yarn.lock@@ -8959,7 +8959,7 @@ normalize-url@^3.0.0, normalize-url@^3.0.1:"notes-core@git+ssh://[email protected]:streetwriters/notesnook-core.git":version "4.3.0"- resolved "git+ssh://[email protected]:streetwriters/notesnook-core.git#3edbea7846ce45a954c33f50638df7f95ac91399"+ resolved "git+ssh://[email protected]:streetwriters/notesnook-core.git#698ec7763018d44350dded1d8d916f3a0ae7cd27"dependencies:fast-sort "^2.0.1"fuzzysearch "^1.0.3"