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
fix: #107
thecodrr4bc4de43295e
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.jsindex dc15d072a..da481ed7a 100644--- a/apps/web/src/stores/editor-store.js+++ b/apps/web/src/stores/editor-store.js@@ -1,6 +1,7 @@import createStore from "../common/store";import { store as noteStore, LIST_TYPES } from "./note-store";import { store as appStore } from "./app-store";+import { store as tagStore } from "./tag-store";import { db } from "../common";import { showPasswordDialog } from "../components/dialogs/passworddialog";@@ -205,11 +206,13 @@ function updateContext(key, array) {// update notes if the selected context (the current view in the navigator) is a tag or colorconst notesState = noteStore.getState();const context = notesState.selectedContext;- console.log(context);if (context.type === type) {const isValue = array.some(value => value === context.value);if (isValue) noteStore.getState().setSelectedContext(context);}+ if (type === "tag") {+ tagStore.getState().refreshTags();+ }}const [useStore, store] = createStore(editorStore);diff --git a/apps/web/src/stores/tag-store.js b/apps/web/src/stores/tag-store.jsnew file mode 100644index 000000000..7d8ff986d--- /dev/null+++ b/apps/web/src/stores/tag-store.js@@ -0,0 +1,18 @@+import createStore from "../common/store";+import { db } from "../common";+import { showPasswordDialog } from "../components/dialogs/passworddialog";++function tagStore(set, get) {+ return {+ tags: [],+ refreshTags: function() {+ set(state => {+ state.tags = db.tags.all;+ });+ }+ };+}++const [useStore, store] = createStore(tagStore);++export { useStore, store };diff --git a/apps/web/src/views/Tags.js b/apps/web/src/views/Tags.jsindex 6f70cd418..b7dd8cba6 100644--- a/apps/web/src/views/Tags.js+++ b/apps/web/src/views/Tags.js@@ -3,7 +3,8 @@ import { Flex, Text } from "rebass";import ListContainer from "../components/list-container";import ListItem from "../components/list-item";import { db } from "../common";-import { useStore } from "../stores/note-store";+import { useStore as useNotesStore } from "../stores/note-store";+import { useStore, store } from "../stores/tag-store";import TagsPlaceholder from "../components/placeholders/tags-placeholder";const TagNode = ({ title }) => (@@ -16,8 +17,11 @@ const TagNode = ({ title }) => ();const Tags = props => {- const setSelectedContext = useStore(store => store.setSelectedContext);- const tags = db.tags.all;+ const setSelectedContext = useNotesStore(store => store.setSelectedContext);+ const tags = useStore(store => store.tags);+ useEffect(() => {+ store.getState().refreshTags();+ }, []);return (<ListContainertype="tags"