From 9ae1a5589666b32439c49d43dcf2d990f1c18114 Mon Sep 17 00:00:00 2001
From: SiriusXT <1160925501@qq.com>
Date: Sat, 29 Nov 2025 11:38:45 +0800
Subject: [PATCH] chore(react/empty): obtain ntxId via React props instead of
DOM query
---
apps/client/src/widgets/type_widgets/Empty.tsx | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/apps/client/src/widgets/type_widgets/Empty.tsx b/apps/client/src/widgets/type_widgets/Empty.tsx
index 013f931fc..83a407493 100644
--- a/apps/client/src/widgets/type_widgets/Empty.tsx
+++ b/apps/client/src/widgets/type_widgets/Empty.tsx
@@ -10,16 +10,16 @@ import FNote from "../../entities/fnote";
import search from "../../services/search";
import { TypeWidgetProps } from "./type_widget";
-export default function Empty({ }: TypeWidgetProps) {
+export default function Empty({ ntxId }: TypeWidgetProps) {
return (
<>
-
+
>
)
}
-function NoteSearch() {
+function NoteSearch({ ntxId }: { ntxId: string | null }) {
const resultsContainerRef = useRef(null);
const autocompleteRef = useRef(null);
@@ -45,7 +45,6 @@ function NoteSearch() {
if (!suggestion?.notePath) {
return false;
}
- const ntxId = autocompleteRef.current?.closest(".note-split")?.getAttribute("data-ntx-id") ?? null;
const activeNoteContext = appContext.tabManager.getNoteContextById(ntxId) ?? appContext.tabManager.getActiveContext();
if (activeNoteContext) {
activeNoteContext.setNote(suggestion.notePath);