Skip to content

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

fix: crash when creating topic

thecodrre4d2d10db6ce
diff --git a/apps/web/src/common/index.js b/apps/web/src/common/index.js
index 999a02d7d..09adbb32b 100644
--- a/apps/web/src/common/index.js
+++ b/apps/web/src/common/index.js
@@ -16,9 +16,9 @@ import { store as userstore } from "../stores/user-store";
export const db = new Database(StorageInterface, EventSource);
db.host({
- API_HOST: "http://192.168.10.5:5264",
- AUTH_HOST: "http://192.168.10.5:8264",
- SSE_HOST: "http://192.168.10.5:7264",
+ API_HOST: "https://192.168.10.5:5264",
+ AUTH_HOST: "https://192.168.10.5:8264",
+ SSE_HOST: "https://192.168.10.5:7264",
});
//db.host("http://192.168.10.5:8100");
// db.host();
diff --git a/apps/web/src/components/dialogs/topicdialog.js b/apps/web/src/components/dialogs/topicdialog.js
index bb544dd44..25d57d4d3 100644
--- a/apps/web/src/components/dialogs/topicdialog.js
+++ b/apps/web/src/components/dialogs/topicdialog.js
@@ -37,7 +37,7 @@ function TopicDialog(props) {
);
}
-export function showTopicDialog(notebook) {
+export function showTopicDialog() {
return showDialog((perform) => (
<TopicDialog
title={"Create a Topic"}
@@ -46,10 +46,11 @@ export function showTopicDialog(notebook) {
onClose={() => {
perform(false);
}}
- onYes={async (topic) => {
+ onAction={async (topic) => {
if (!topic) return;
- await db.notebooks.notebook(notebook).topics.add(topic);
- store.setSelectedNotebookTopics(notebook);
+ const notebookId = store.get().selectedNotebookId;
+ await db.notebooks.notebook(notebookId).topics.add(topic);
+ store.setSelectedNotebookTopics(notebookId);
perform(true);
}}
/>
diff --git a/apps/web/src/stores/notebook-store.js b/apps/web/src/stores/notebook-store.js
index d120a2858..9f375edf2 100644
--- a/apps/web/src/stores/notebook-store.js
+++ b/apps/web/src/stores/notebook-store.js
@@ -7,6 +7,7 @@ import { showToast } from "../utils/toast";
class NotebookStore extends BaseStore {
notebooks = [];
selectedNotebookTopics = [];
+ selectedNotebookId = 0;
refresh = () => {
this.set((state) => (state.notebooks = db.notebooks.all));
@@ -39,6 +40,7 @@ class NotebookStore extends BaseStore {
setSelectedNotebookTopics = (id) => {
this.set((state) => {
state.selectedNotebookTopics = db.notebooks.notebook(id).topics.all;
+ state.selectedNotebookId = id;
});
};
}
diff --git a/apps/web/yarn.lock b/apps/web/yarn.lock
index c316c703d..0d22b8dbe 100644
--- a/apps/web/yarn.lock
+++ b/apps/web/yarn.lock
@@ -8975,7 +8975,7 @@ normalize-url@^3.0.0, normalize-url@^3.0.1:
"notes-core@git+ssh://[email protected]:streetwriters/notesnook-core.git":
version "5.2.0"
- resolved "git+ssh://[email protected]:streetwriters/notesnook-core.git#aa6b60d1988e5248aa1c2902c070b3a41bb456eb"
+ resolved "git+ssh://[email protected]:streetwriters/notesnook-core.git#50c790bb17b74537cd101d943e9e892bc2ff3a56"
dependencies:
fast-sort "^2.0.1"
fuzzysearch "^1.0.3"