Make devTools registration opt-in (fixes #6250).#6264
Make devTools registration opt-in (fixes #6250).#6264ckifer merged 2 commits intorecharts:mainfrom uncaught:issue_6250_dev_tools
Conversation
| touchEventMiddleware.middleware, | ||
| ]), | ||
| devTools: { | ||
| devTools: !!window.RECHARTS_DEV_TOOLS_ENABLED && { |
There was a problem hiding this comment.
Can we enable this by default in storybooks?
There was a problem hiding this comment.
Yes, I've added the flag to the storybook. I hope preview.ts is an appropriate place, it looks like config - I haven't worked with storybooks before.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6264 +/- ##
==========================================
- Coverage 96.63% 96.61% -0.03%
==========================================
Files 221 221
Lines 20147 20147
Branches 4129 4130 +1
==========================================
- Hits 19470 19465 -5
- Misses 670 675 +5
Partials 7 7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@uncaught this breaks some Next JS builds |
| touchEventMiddleware.middleware, | ||
| ]), | ||
| devTools: { | ||
| devTools: !!window.RECHARTS_DEV_TOOLS_ENABLED && { |
There was a problem hiding this comment.
we need to check if window is defined
There was a problem hiding this comment.
Oh dang, please see #6309
I suppose using that Global-module is cleaner than using window anyway.
See #6264 Replaces `window.RECHARTS_DEV_TOOLS_ENABLED` with `Global.devToolsEnabled`
Description
Makes devTools-registration opt-in via global flag.
Related Issue
#6250
Motivation and Context
The Redux DevTools browser extension does not handle multiple tabs with multiple registered stores well. They are all garbaged together in every instance of the opened dev tools.
You might have a production page open in one tab, showing a few recharts-charts. And then in another tab you have your own development software running, which uses redux for example, but doesn't even have any charts in it. But still you will get all the recharts store entries there.
For recharts developers using this, I would recommend using something like:
How Has This Been Tested?
Used
pnpm patchto patch recharts and see the effects in our app in the dev tools.Types of changes
Checklist:
This change only affects recharts-developers, not any chart implementation in the user-space.