connected-react-router icon indicating copy to clipboard operation
connected-react-router copied to clipboard

Route doesn't change when updated via address bar

Open glundgren93 opened this issue 5 years ago • 5 comments

set up the connected-react-router as doc.but it doesn't change routes when I change url via address bar. It stays on the same page.

 import { createStore, applyMiddleware, compose } from "redux";
 import thunk from "redux-thunk";
 import rootReducer from "store/combineReducers";
 import { routerMiddleware } from "connected-react-router";
 import { createBrowserHistory } from "history";
 export const history = createBrowserHistory();

const middles = [thunk, routerMiddleware(history)];

export default function configureStore(preloadedState) {
    const store = createStore(
        rootReducer(history), // root reducer with router state
        preloadedState,
        compose(applyMiddleware(...middles))
     );
return store;
}

 export default history =>
     combineReducers({
          router: connectRouter(history),
          ...
      });

    

 ReactDOM.render(
        <ThemeProvider>
            <Provider store={store}>
                <ConnectedRouter history={history}>
                    <div className="react-root">
                        <Suspense fallback={<Loading />}>
                            <Route component={ErrorModal} />
                            <Route component={WarningModal} />
                            <Route component={Loading} />
                            <Switch>
                                <Route exact path="/" component={Login} />
                                <Route component={Auth(Wrapper)} />
                            </Switch>
                        </Suspense>
                    </div>
                </ConnectedRouter>
            </Provider>
        </ThemeProvider>,
        document.getElementById('root')
    );

any suggestions?

Thanks

glundgren93 avatar Oct 15 '19 12:10 glundgren93

I have the same problem if i follow these intructions https://github.com/supasate/connected-react-router/issues/299#issuecomment-531435514

xzessmedia avatar Oct 19 '19 23:10 xzessmedia

... This isnt the actual example is it or bits of three pages of an example? If this is what your trying to run there are obvious problems but I'm guessing these are more or less snippets out of your project?

ghost avatar Nov 07 '19 00:11 ghost

Same here https://github.com/supasate/connected-react-router/issues/311 Try redux-first-history, no location issue.

salvoravida avatar Nov 26 '19 23:11 salvoravida

@glundgren93 Your routes don't seem to have paths?

agriffis avatar Feb 20 '20 23:02 agriffis

I'm having the same issue, as far as I can tell from the README my configuration is correct. @glundgren93 were you ever able to figure out a solution for this?

donleistman avatar Jul 30 '20 22:07 donleistman