Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
honeypc opened this issue Mar 24, 2024 · 0 comments

Comments

@honeypc
Copy link

honeypc commented Mar 24, 2024

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);
        };
    }
});


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant