PostHog / posthog

🦔 PostHog provides open-source product analytics, session recording, feature flagging and A/B testing that you can self-host.
https://posthog.com
Other
21.53k stars 1.29k forks source link

Redux DevTools are causing slowdowns #17482

Closed MarconLP closed 1 month ago

MarconLP commented 1 year ago

Bug description

It seems that Redux DevTools are causing the slowdown, perhaps because the developer version of Redux is being distributed in production, or some subset is being included for production debugging.

How to reproduce

  1. Using Firefox, ensure Redux DevTools installed (I'm sure this happens on any browser, but I have not yet tested)
  2. Open the PostHog app normally, note that it works perfectly well
  3. Open dev tools (F12 or r-click -> Inspect) and then open the Redux tab to initialize the tool
  4. Refresh PostHog and try to click around, noting how sluggish the app has become

Additional context

related ticket: https://posthoghelp.zendesk.com/agent/tickets/5822

Thank you for your bug report – we love squashing them!

Twixes commented 1 year ago

Maybe something with Kea @mariusandra?

mariusandra commented 1 year ago

Unlikely to be kea per se, but likely we're dispatching actions with non-jsonable content somewhere that's causing issues when devtools inspect it. Things like self-references or large objects (e.g. window) that shouldn't be there in the first place.

mariusandra commented 1 year ago

If this is happening on your site, then it's likely it only happens when the toolbar is enabled, not when you're just using posthog-js to track events.

speedy250 commented 1 year ago

As the original reporter of this bug, I will clarify that this issue occurs for me when visiting app.posthog.com

If redux dev tools extension is enabled, then the site will become unusable.

Here's a video to illustrate; look for yellow circles around the mouse to show click actions. I move the mouse around after clicking to show I'm waiting on the site.

https://github.com/PostHog/posthog/assets/3361507/7a48a3a9-981c-4aee-852d-4eaf20b5895f

pauldambra commented 2 months ago

I guess it's this https://github.com/reduxjs/redux-devtools/issues/437

pauldambra commented 2 months ago

and there's a proposed fix in an approved by unmerged PR from 2019 🤯 so I guess if we want to fix this it needs to be in posthog :)

MarconLP commented 1 month ago

+1 https://posthoghelp.zendesk.com/agent/tickets/17162

MarconLP commented 1 month ago

+1 https://posthoghelp.zendesk.com/agent/tickets/17233

pauldambra commented 1 month ago

+1 https://posthoghelp.zendesk.com/agent/tickets/17344

abigailbramble commented 1 month ago

+1 https://posthoghelp.zendesk.com/agent/tickets/17383 +1 https://posthoghelp.zendesk.com/agent/tickets/17206 +1 https://posthoghelp.zendesk.com/agent/tickets/17311 +1 https://posthoghelp.zendesk.com/agent/tickets/17351 +1 https://posthoghelp.zendesk.com/agent/tickets/17271 +1 https://posthoghelp.zendesk.com/agent/tickets/17353

pauldambra commented 1 month ago

and see: https://github.com/reduxjs/redux-devtools/issues/1732

pauldambra commented 1 month ago

should be fixed by https://github.com/PostHog/posthog/pull/24611

so we can't use redux dev tools when debugging posthog in dev but that's a trade-off that's worth it to avoid this

slshults commented 1 month ago

Replied to all the tickets listed above to let them know the good news. Closing (should be fixed by https://github.com/PostHog/posthog/pull/24611 )