zalmoxisus / redux-devtools-extension

Redux DevTools extension.
MIT License
13.5k stars 1k forks source link

Always "No store found" #308

Open wzup opened 7 years ago

wzup commented 7 years ago

The extension doesn't start.

I have an app with server side rendering. Following the instruction, I set up the plugin like this.

On server routes.js

const composeWithDevTools = require('redux-devtools-extension').composeWithDevTools;

let store = createStore(reducer, state, composeWithDevTools(applyMiddleware(thunkMiddleware, loggerMiddleware)));
let html = ReactDOMServer.renderToString(getApp(store, renderProps));

In browser's part:

let store = createStore(
    reducers,
    window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() && window.__state__,
    applyMiddleware(thunkMiddleware, loggerMiddleware)
);

let Application = (
    <Provider store={store}>
        { routes }
    </Provider>
)

But I always get No store found. What do I miss? How to make it work?

chrome reduxdevtools no store found - google chrome 2017-02-12 09 08 25

zalmoxisus commented 7 years ago

See the usage. So, you're applying the extension spreloadedStatetocreateStore`. It should be:

+ const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
let store = createStore(
    reducers,
    window.__state__,
    composeEnhancers(applyMiddleware(thunkMiddleware, loggerMiddleware))
);

As per server side, click Remote button from the bottom.

alozytskyi commented 7 years ago

@zalmoxisus I updated createStore to use above example, still have No store found half of the time.

lfender6445 commented 7 years ago

same error for me via chrome extension:

  const middleware = applyMiddleware(
    routerMiddleware(),
    thunk,
    apolloClient.middleware(),
  )

  const enhancers = [
    middleware,
  ]

  const composeEnhancers =
    typeof window !== 'undefined' &&
      window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?
      window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : compose

  const store = createStore(
    combineReducers({
      apollo: apolloClient.reducer(),
      criteria,
      searchInput,
      listGallery,
      router,
    }),
    initialState,
    composeEnhancers(...enhancers)
  )

happens intermittently but works 25% of the time

Sawtaytoes commented 6 years ago

Is your issue related to #547?

terrynguyen255 commented 4 years ago

I'm facing the same problem. window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ is always undefined Version: 2.17.0 on Ubuntu Chrome

Tried these but doesn't help:

  1. Turned on "Allow access to file URLs" image

  2. Click "Reload frame" image