diff --git a/app/assets/javascripts/discourse/app/lib/raw-render-glimmer.js b/app/assets/javascripts/discourse/app/lib/raw-render-glimmer.js index a42428107cf..6b7e22e303d 100644 --- a/app/assets/javascripts/discourse/app/lib/raw-render-glimmer.js +++ b/app/assets/javascripts/discourse/app/lib/raw-render-glimmer.js @@ -41,12 +41,14 @@ export default function rawRenderGlimmer(owner, renderInto, component, data) { schedule("afterRender", () => { const element = document.getElementById(id); - const componentInfo = { - element, - component, - data, - }; - renderGlimmerService.add(componentInfo); + if (element) { + const componentInfo = { + element, + component, + data, + }; + renderGlimmerService.add(componentInfo); + } }); return `<${type} id="${id}" class="${classNames.join(" ")}">`;