Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(new_tab): workspace switcher no longer displayed
Elian Doran0eec8042ca5e
diff --git a/e2e/layout/tab_bar.spec.ts b/e2e/layout/tab_bar.spec.tsindex c5a3d7e5c5..c064dbf573 100644--- a/e2e/layout/tab_bar.spec.ts+++ b/e2e/layout/tab_bar.spec.ts@@ -117,3 +117,17 @@ test("Search works when dismissing a tab", async ({ page, context }) => {await app.openAndClickNoteActionMenu("Search in note");await expect(app.findAndReplaceWidget).toBeVisible();});++test("New tab displays workspaces", async ({ page, context }) => {+ const app = new App(page, context);+ await app.goto();++ const workspaceNotesEl = app.currentNoteSplitContent.locator(".workspace-notes");+ await expect(workspaceNotesEl).toBeVisible();+ expect(workspaceNotesEl).toContainText("Personal");+ expect(workspaceNotesEl).toContainText("Work");+ await expect(workspaceNotesEl.locator(".bx.bxs-user")).toBeVisible();+ await expect(workspaceNotesEl.locator(".bx.bx-briefcase-alt")).toBeVisible();++ await app.closeAllTabs();+});diff --git a/integration-tests/db/document.db b/integration-tests/db/document.dbindex c9f96195bf..c02b60d345 100644Binary files a/integration-tests/db/document.db and b/integration-tests/db/document.db differdiff --git a/src/public/app/widgets/type_widgets/empty.ts b/src/public/app/widgets/type_widgets/empty.tsindex 231f16fbec..2f90b5159e 100644--- a/src/public/app/widgets/type_widgets/empty.ts+++ b/src/public/app/widgets/type_widgets/empty.ts@@ -99,7 +99,7 @@ export default class EmptyTypeWidget extends TypeWidget {super.doRender();}- async doRefresh(note: FNote) {+ async doRefresh() {const workspaceNotes = await searchService.searchForNotes("#workspace #!template");this.$workspaceNotes.empty();diff --git a/src/public/app/widgets/type_widgets/type_widget.ts b/src/public/app/widgets/type_widgets/type_widget.tsindex 02257b19e6..3a437e1092 100644--- a/src/public/app/widgets/type_widgets/type_widget.ts+++ b/src/public/app/widgets/type_widgets/type_widget.ts@@ -3,6 +3,7 @@ import appContext, { type EventData, type EventNames } from "../../components/apimport type FNote from "../../entities/fnote.js";import type NoteDetailWidget from "../note_detail.js";import type SpacedUpdate from "../../services/spaced_update.js";+import type EmptyTypeWidget from "./empty.js";/*** The base class for all the note types.@@ -33,8 +34,12 @@ export default abstract class TypeWidget extends NoteContextAwareWidget {} else {this.toggleInt(true);- if (this.note) {+ // Avoid passing nullable this.note down to doRefresh().+ if (thisWidgetType !== "empty" && this.note) {await this.doRefresh(this.note);+ } else if (thisWidgetType === "empty") {+ // EmptyTypeWidget is a special case, since it's used for a new tab where there's no note.+ await (this as unknown as EmptyTypeWidget).doRefresh();}this.triggerEvent("noteDetailRefreshed", { ntxId: this.noteContext?.ntxId });