From a43f6b15146d306232ff3af58b8d0155f97bd72b Mon Sep 17 00:00:00 2001 From: Marius Andra Date: Tue, 27 Aug 2024 19:20:04 +0200 Subject: [PATCH] fix(redux): disable devtools (#24611) Co-authored-by: Paul D'Ambra --- frontend/src/initKea.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/frontend/src/initKea.ts b/frontend/src/initKea.ts index 5117138b0446a..d3051cb01a06d 100644 --- a/frontend/src/initKea.ts +++ b/frontend/src/initKea.ts @@ -118,7 +118,28 @@ export function initKea({ routerHistory, routerLocation, beforePlugins }: InitKe plugins.push(loggerPlugin) } + if ((window as any).__REDUX_DEVTOOLS_EXTENSION__) { + // eslint-disable-next-line no-console + console.log('NB Redux Dev Tools are disabled on PostHog. See: https://github.com/PostHog/posthog/issues/17482') + } + resetContext({ plugins: plugins, + createStore: { + // Disable redux dev-tools's compose by passing `compose` from redux directly + compose: ((...funcs: any[]) => { + if (funcs.length === 0) { + return (arg: T) => arg + } + if (funcs.length === 1) { + return funcs[0] + } + return funcs.reduce( + (a, b) => + (...args: any) => + a(b(...args)) + ) + }) as any, + }, }) }