Skip to content

Build your personal knowledge base with Trilium Notes

chore(react/ribbon): fix activation of add new label to all tabs

Elian Doran1c7dfa6c91a3
diff --git a/apps/client/src/widgets/ribbon/OwnedAttributesTab.tsx b/apps/client/src/widgets/ribbon/OwnedAttributesTab.tsx
index 9169b3c2f2..532e7ee298 100644
--- a/apps/client/src/widgets/ribbon/OwnedAttributesTab.tsx
+++ b/apps/client/src/widgets/ribbon/OwnedAttributesTab.tsx
@@ -2,13 +2,17 @@ import { useTriliumEvents } from "../react/hooks";
import AttributeEditor from "./components/AttributeEditor";
import { TabContext } from "./ribbon-interface";
-export default function OwnedAttributesTab({ note, hidden, activate, ...restProps }: TabContext) {
- useTriliumEvents([ "addNewLabel", "addNewRelation" ], activate);
+export default function OwnedAttributesTab({ note, hidden, activate, ntxId, ...restProps }: TabContext) {
+ useTriliumEvents([ "addNewLabel", "addNewRelation" ], ({ ntxId: eventNtxId }) => {
+ if (ntxId === eventNtxId) {
+ activate();
+ }
+ });
return (
<div className="attribute-list">
{ note && (
- <AttributeEditor note={note} {...restProps} hidden={hidden} />
+ <AttributeEditor ntxId={ntxId} note={note} {...restProps} hidden={hidden} />
)}
</div>
)