Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Cannot read property 'pathname' of undefined #28

Open
mrmuhammadali opened this issue Dec 5, 2018 · 1 comment
Open

Cannot read property 'pathname' of undefined #28

mrmuhammadali opened this issue Dec 5, 2018 · 1 comment

Comments

@mrmuhammadali
Copy link

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

  • fusion-plugin-connected-react-router version: 1.0.1

  • Node.js version: 8.11

  • npm version: 5.6.0

  • Operating System: macOS Mojave

@ganemone
Copy link
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants