react-google-charts icon indicating copy to clipboard operation
react-google-charts copied to clipboard

Fix intermittent loading issue

Open Schlickmann opened this issue 1 year ago • 2 comments

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.

Schlickmann avatar Feb 01 '24 00:02 Schlickmann

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

vercel[bot] avatar Feb 01 '24 00:02 vercel[bot]

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.

wavebeem avatar Feb 01 '24 01:02 wavebeem