diff --git a/src/public/app/widgets/search_box.js b/src/public/app/widgets/search_box.js
index cc9ce0344..cce532372 100644
--- a/src/public/app/widgets/search_box.js
+++ b/src/public/app/widgets/search_box.js
@@ -3,6 +3,7 @@ import toastService from "../services/toast.js";
import appContext from "../services/app_context.js";
import noteCreateService from "../services/note_create.js";
import utils from "../services/utils.js";
+import treeCache from "../services/tree_cache.js";
const TPL = `
@@ -105,14 +106,13 @@ export default class SearchBoxWidget extends BasicWidget {
return;
}
- // FIXME
- let activeNote = appContext.tabManager.getActiveTabNote();
+ let parent = appContext.tabManager.getActiveTabNote();
- if (activeNote.type === 'search') {
- activeNote = activeNote.getParentNotes()[0];
+ if (parent.type === 'search') {
+ parent = await treeCache.getNote('root');
}
- await noteCreateService.createNote(activeNote.noteId, {
+ await noteCreateService.createNote(parent.noteId, {
type: "search",
mime: "application/json",
title: searchString,
diff --git a/src/public/app/widgets/type_widgets/search.js b/src/public/app/widgets/type_widgets/search.js
index 81993b25b..7a2698c28 100644
--- a/src/public/app/widgets/type_widgets/search.js
+++ b/src/public/app/widgets/type_widgets/search.js
@@ -1,7 +1,7 @@
import TypeWidget from "./type_widget.js";
const TPL = `
-