fusionjs / fusion-plugin-connected-react-router

Migrated to https://github.com/fusionjs/fusionjs
MIT License
2 stars 9 forks source link

Cannot read property 'pathname' of undefined #28

Open mrmuhammadali opened 5 years ago

mrmuhammadali commented 5 years ago

Type of issue

Bug

Description

Project builds successfully but I get following error on app start:

TypeError: Cannot read property 'pathname' of undefined at /Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/connected-react-router/lib/ConnectedRouter.js:58:37 at dispatch (/Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/redux/lib/redux.js:220:7) at /Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/redux-logger/dist/redux-logger.js:1:7807 at /Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/redux-thunk/lib/index.js:14:16 at oldDispatch (/Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/fusion-plugin-connected-react-router/src/index.js:37:20) at /Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/connected-react-router/lib/middleware.js:25:18 at store.dispatch.action (/Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/fusion-plugin-connected-react-router/src/index.js:36:18) at Object.onLocationChanged (/Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/connected-react-router/lib/ConnectedRouter.js:154:16) at handleLocationChange (/Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/connected-react-router/lib/ConnectedRouter.js:85:17) at new ConnectedRouter (/Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/connected-react-router/lib/ConnectedRouter.js:94:7)

My Code looks something like this: app.register(RouterToken, Router) app.register(RouterProviderToken, ConnectedRouter) app.register(ConnectedRouterEnhancerToken, ConnectedRouterEnhancer) app.register( EnhancerToken, createPlugin({ deps: { connectedRouterEnhancer: ConnectedRouterEnhancerToken }, provides: ({ connectedRouterEnhancer }) => { const enhancer = composeEnhancers( connectedRouterEnhancer, applyMiddleware(...middlewares), ) return enhancer }, }), ) app.register(ReduxToken, Redux) app.register(ReducerToken, rootReducer)

Current behavior

App crashes

Steps to reproduce

I've followed the steps given in the documentation but failed to connect this plugin.

Your environment

ganemone commented 5 years ago

This plugin isn't super well supported right now. It was built as a proof of concept. I recommend keeping routing logic separate from the redux store and using the withRouter hoc to get access to routing related props.