react-google-charts
react-google-charts copied to clipboard
Fix intermittent loading issue
Hey folks, there is this bug reported here and I've been facing the same intermittently and debugging the project we found that the event listeners were being removed before the script finished loading.
Removing those lines of code the loading issue stops happening.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
react-google-charts-v2 | ❌ Failed (Inspect) | Feb 1, 2024 0:24am |
Hello! I was working on this with @Schlickmann and wanted to add my thoughts about the fix.
It's probably always the right thing to remove an event listener when a useEffect
is done, but for some reason that's causing an infinite loading bug for us. I didn't understand the code well enough to pursue a more specific fix.
The "best" solution might be more involved than this, but this does seem to work. Additionally, I would think this won't leak very many event listeners, since subsequent loads will find the script tag already in the DOM. I would expect this to leak a finite amount of event listeners across repeated page navigation because of this.