themesberg / themesberg/flowbite
Uncaught TypeError: Cannot read properties of null (reading 'render') Turbo-rails + Flowbite
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 9.4k
- Forks
- 862
- PR merge metrics
- No merged PRs in 30d
Description
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
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);
};
}
});
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at src/index.turbo.ts#L22, where the custom Turbo.renderStreamMessage(HTML) integration is referenced. Reproduce the null render TypeError with the Turbo Rails and Flowbite setup, then compare the turbo:before-stream-render event handling shown in the issue. Done means stream rendering no longer throws and the after-render event behavior remains available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100