flowbite icon indicating copy to clipboard operation
flowbite copied to clipboard

Uncaught TypeError: Cannot read properties of null (reading 'render') Turbo-rails + Flowbite

Open honeypc opened this issue 1 year ago • 0 comments

Describe the bug The issue happened while I was using the custom render template Turbo.renderStreamMessage(HTML) at https://github.com/themesberg/flowbite/blob/main/src/index.turbo.ts#L22

Screenshots Screenshot 2024-03-24 191544

Expected behavior So we can handle the issue by updating like this

addEventListener('turbo:before-stream-render', (event: CustomEvent) => {
    if(event.detail) {
        const originalRender = event.detail.render;

        event.detail.render = function (streamElement: Element) {
            originalRender(streamElement);
            document.dispatchEvent(afterRenderEvent);
        };
    }
});


honeypc avatar Mar 24 '24 12:03 honeypc