diff --git a/packages/tecrock-table/src/components/report-item/report-item.tsx b/packages/tecrock-table/src/components/report-item/report-item.tsx index 73d895cc..806b1e11 100644 --- a/packages/tecrock-table/src/components/report-item/report-item.tsx +++ b/packages/tecrock-table/src/components/report-item/report-item.tsx @@ -17,37 +17,35 @@ import classMap from "../table.scss"; // this specific case. const reportItemScript = ""; @@ -62,12 +60,16 @@ export const reportItemHandler: IGetReportItemAnswerHandler, inlineCss, classMap - ); + ) + + // Add a stringified script tag to the end of the HTML string. It's important to do it after the closing body tag, + // because otherwise the script will be executed before the table is rendered. That way we can avoid using + // DOM mutation observers to detect when the table is rendered or relying on other callbacks or timing tricks. + reportItemScript; + items.push({type: "html", html: htmlWithInlineStyles}); sendReportItemAnswer({version, platformUserId, items, itemsType}); } else {