xstate-devtools
xstate-devtools copied to clipboard
xstate-devtools breaks Confluence document page
After installing xstate-devtools Google Chrome extension, users can no longer enter any document page in Confluence:
It seems that Confluence tries to invoke global.__REDUX_DEVTOOLS_EXTENSION__
manually. Invoking global.__REDUX_DEVTOOLS_EXTENSION__
as a function is the documented usage in https://github.com/zalmoxisus/redux-devtools-extension#11-basic-store , but it contradicts with the behavior here: https://github.com/amitnovick/xstate-devtools/blob/6f9dc9cc3463cf8a4a60ec769b65d69fcbbf4206/public/extension/injected/injected.js#L75
Thanks for documenting this issue!
Currently the XState integration of this extension piggy-backs on the "Redux DevTools" global namespace window.__REDUX_DEVTOOLS_EXTENSION__
as you've noticed.
I am looking to replace this global namespace to something else, and this has to happen in the XState repo.
This is the issue for progress on that: https://github.com/davidkpiano/xstate/issues/848
One way to fix this extension breaking pages is to change the line in question to:
if (window.__REDUX_DEVTOOLS_EXTENSION__ ) {
window.__REDUX_DEVTOOLS_EXTENSION__.connect = __XSTATE_DEVTOOLS_EXTENSION__.connect;
} else {
window.__REDUX_DEVTOOLS_EXTENSION__ = __XSTATE_DEVTOOLS_EXTENSION__;
}
This way, if __REDUX_DEVTOOLS_EXTENSION__
is already defined, you simply change the connect
function, but keep everything else the same.
@kgroat
Could you test to see if the code you suggested solves the issue in the Confluence app? I would like to make sure that it actually does solve it before pushing a potentially breaking change to users. Would've done it myself if I had been using Confluence, and also I'm not sure how to reproduce the error even if I tried the free version that I just saw is available on their homepage.
Workaround: Right click the extension, choose "This site can read and change site data" > "When you click the extension".
@amitnovick This can now be tested on reddit.com (new layout) as well, as the site breaks with the extension enabled. See https://github.com/amitnovick/xstate-devtools/issues/22#issuecomment-640811413