1

I use react with redux. In one of my components I open new window by:

 import { store } from "index"

 this.detachedWindow = window.open();
 this.detachedWindow.store = store;

So I have two windows open with same store. The problem is when I open new window and then close it. Then I change my url location in old window then there is media query problem like:

Uncaught TypeError: Cannot read property 'addListener' of null
  at new r (MediaQuery.js:23)
  at register (MediaQueryDispatch.js:42)
  at row.js:105
  at Array.map ()
  at t.value (row.js:104)
  at commitLifeCycles (react-dom.production.min.js:169)
  at n (react-dom.production.min.js:180)
  at c (react-dom.production.min.js:183)
  at l (react-dom.production.min.js:184)
  at p (react-dom.production.min.js:188)

It only exists when I open and then close new window. What can be reason of it?

Patryk Imosa
  • 785
  • 2
  • 10
  • 31
  • Not sure if a redux store can be "transferred" with a simple assignment like that. There might be more bootstrap/setup code required to initialize it properly in a new window context. – timotgl Mar 16 '18 at 20:40
  • You have to elaborate more on that. Anyways, if you are doing an `addListener` in, say, `componentDidMount`, you can do a `removeListener` in `componentWillUnmount` and see if it works. – yadav_vi Mar 20 '18 at 06:53

0 Answers0