xstate-devtools icon indicating copy to clipboard operation
xstate-devtools copied to clipboard

xstate-devtools breaks Confluence document page

Open MrOrz opened this issue 5 years ago • 5 comments

After installing xstate-devtools Google Chrome extension, users can no longer enter any document page in Confluence:

螢幕快照 2020-01-14 下午3 47 58

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

MrOrz avatar Jan 14 '20 07:01 MrOrz

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

amitnovick avatar Jan 14 '20 21:01 amitnovick

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 avatar Jan 22 '20 00:01 kgroat

@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.

amitnovick avatar Jan 22 '20 22:01 amitnovick

Workaround: Right click the extension, choose "This site can read and change site data" > "When you click the extension".

Glutnix avatar Mar 09 '20 22:03 Glutnix

@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

skoshy avatar Jun 08 '20 19:06 skoshy