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(react): search crashing due to bad rendering mechanism
Elian Doran2152ca7ba6ab
diff --git a/apps/client/src/widgets/ribbon/SearchDefinitionOptions.tsx b/apps/client/src/widgets/ribbon/SearchDefinitionOptions.tsxindex 3cd1b40041..45d8128444 100644--- a/apps/client/src/widgets/ribbon/SearchDefinitionOptions.tsx+++ b/apps/client/src/widgets/ribbon/SearchDefinitionOptions.tsx@@ -21,7 +21,7 @@ export interface SearchOption {icon: string;label: string;tooltip?: string;- component?: (props: SearchOptionProps) => VNode;+ component: (props: SearchOptionProps) => VNode;defaultValue?: string;additionalAttributesToDelete?: { type: "label" | "relation", name: string }[];}diff --git a/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx b/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsxindex c24c1d8037..65cb9a0503 100644--- a/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx+++ b/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx@@ -95,15 +95,16 @@ export default function SearchDefinitionTab({ note, ntxId }: TabContext) {</tr><tbody className="search-options">{searchOptions?.activeOptions.map(({ attributeType, attributeName, component, additionalAttributesToDelete, defaultValue }) => {- return component?.({- attributeName,- attributeType,- note,- refreshResults,- error,- additionalAttributesToDelete,- defaultValue- });+ const Component = component;+ return <Component+ attributeName={attributeName}+ attributeType={attributeType}+ note={note}+ refreshResults={refreshResults}+ error={error}+ additionalAttributesToDelete={additionalAttributesToDelete}+ defaultValue={defaultValue}+ />;})}</tbody><BulkActionsList note={note} />