web: fix topic search

This commit is contained in:
Abdullah Atta
2023-03-23 13:12:43 +05:00
committed by Abdullah Atta
parent 90a3bd3307
commit 0aeade69da

View File

@@ -40,9 +40,9 @@ async function typeToItems(type, context) {
case "notebooks":
return ["notebooks", db.notebooks.all];
case "topics": {
const notebookId = notebookstore.get().selectedNotebookId;
if (!notebookId) return ["topics", []];
const topics = db.notebooks.notebook(notebookId).topics.all;
const selectedNotebook = notebookstore.get().selectedNotebook;
if (!selectedNotebook) return ["topics", []];
const topics = db.notebooks.notebook(selectedNotebook.id).topics.all;
return ["topics", topics];
}
case "tags":
@@ -114,9 +114,9 @@ function Search({ type }) {
case "notebooks":
return "all notebooks";
case "topics": {
const notebookId = notebookstore.get().selectedNotebookId;
if (!notebookId) return "";
const notebook = db.notebooks.notebook(notebookId);
const selectedNotebook = notebookstore.get().selectedNotebook;
if (!selectedNotebook) return "";
const notebook = db.notebooks.notebook(selectedNotebook.id);
return `topics in ${notebook.title} notebook`;
}
case "tags":