Skip to content

Build your personal knowledge base with Trilium Notes

chore(react/collections/table): fix occasional error when initializing

Elian Doran33a37be37820
diff --git a/apps/client/src/widgets/collections/table/tabulator.tsx b/apps/client/src/widgets/collections/table/tabulator.tsx
index 9191f22da7..fdcbeb532f 100644
--- a/apps/client/src/widgets/collections/table/tabulator.tsx
+++ b/apps/client/src/widgets/collections/table/tabulator.tsx
@@ -33,11 +33,13 @@ export default function Tabulator<T>({ className, columns, data, modules, tabula
columns,
data,
footerElement: (parentComponent && footerElement ? renderReactWidget(parentComponent, footerElement)[0] : undefined),
- ...restProps,
+ ...restProps
});
- tabulatorRef.current = tabulator;
- externalTabulatorRef.current = tabulator;
+ tabulator.on("tableBuilt", () => {
+ tabulatorRef.current = tabulator;
+ externalTabulatorRef.current = tabulator;
+ });
return () => tabulator.destroy();
}, []);