fathom-client icon indicating copy to clipboard operation
fathom-client copied to clipboard

Fathom script loaded twice

Open bitstein opened this issue 1 year ago • 2 comments

I followed the instructions for adding this to app router. I see the script being loaded twice.

image

bitstein avatar Feb 29 '24 19:02 bitstein

I wonder if this is a React Strict Mode thing. Can you try disabling strict mode and see if this behavior stops? https://nextjs.org/docs/pages/api-reference/next-config-js/reactStrictMode

It's probably worth making our load function be a bit smarter about only injecting the script if it's not present on page already.

derrickreimer avatar Mar 11 '24 14:03 derrickreimer

I wonder if this is a React Strict Mode thing. Can you try disabling strict mode and see if this behavior stops? https://nextjs.org/docs/pages/api-reference/next-config-js/reactStrictMode

It's probably worth making our load function be a bit smarter about only injecting the script if it's not present on page already.

@derrickreimer I can confirm that when I disable strict mode, the script is only loaded once.

Screenshot from 2024-03-11 09-43-18

bitstein avatar Mar 11 '24 14:03 bitstein

Thank you! I can confirm this is fixed on my production website.

bitstein avatar Jun 13 '24 21:06 bitstein