Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trackHistory is not a function #12

Open
JanMesaric opened this issue Apr 8, 2016 · 8 comments
Open

trackHistory is not a function #12

JanMesaric opened this issue Apr 8, 2016 · 8 comments

Comments

@JanMesaric
Copy link

Hi,

I'm having problem:
index.js:172 Uncaught TypeError: (0 , _reduxStateHistory.trackHistory) is not a function

I've followed the instructions and always get this. Any suggestions?

Sincerely,
Jan

@inakianduaga
Copy link
Owner

I don't have check it now, I see if I can take a look at it on the weekend. You would have to post some details of the configuration / how you're setting up things at any rate

@JanMesaric
Copy link
Author

Ok, here is my package.json (prior to redux-state-history):

{
  "devDependencies": {
    "babel": "^6.5.2",
    "babel-core": "^6.5.2",
    "babel-loader": "^6.2.3",
    "babel-preset-es2015": "^6.5.0",
    "babel-preset-react": "^6.5.0",
    "gulp": "^3.8.8",
    "laravel-elixir": "*",
    "webpack-dev-server": "^1.14.1"
  },
  "scripts": {
    "start": "webpack-dev-server"
  },
  "main": "index.js",
  "dependencies": {
    "clipboard": "^1.5.8",
    "history": "^2.0.1",
    "isomorphic-fetch": "^2.2.1",
    "jwt-decode": "^1.5.1",
    "lodash": "^4.3.0",
    "moment": "^2.12.0",
    "react": "^0.14.7",
    "react-bootstrap": "^0.28.3",
    "react-dom": "^0.14.7",
    "react-dropzone": "^3.3.2",
    "react-grid-layout": "^0.10.6",
    "react-mixin": "^2.0.2",
    "react-redux": "^4.4.0",
    "react-router": "^2.0.0",
    "react-router-redux": "^4.0.0",
    "redux": "^3.3.1",
    "redux-devtools": "^3.1.1",
    "redux-router": "^1.0.0-beta7",
    "redux-thunk": "^1.0.3",
    "webpack": "^1.12.13"
  }
}

I'm using combineReducers and composing the store like this:

const store = compose(
    debugStateHistory,
    applyMiddleware(thunk),
    trackHistory(),
window.devToolsExtension ? window.devToolsExtension() : f => f
)(createStore)(RootReducer, defaultData);

Let me know what else do you need.

@inakianduaga
Copy link
Owner

can you post the combineReducers function?

@JanMesaric
Copy link
Author

const RootReducer = combineReducers({
    // router
    router: routerStateReducer,
    Auth,
    Images,
    stateHistory: (state = {}, action) => state
});

@jakubwolny
Copy link

I checked the source code and I think trackHistory has been renamed to stateHistoryTracker

@inakianduaga
Copy link
Owner

@janckk I'm currently swamped in other things so not much time to work on this or look at your comment. I plan on adding this to a current react app I use for work so I'll get to improving it at some point

@JanMesaric
Copy link
Author

JanMesaric commented Jun 18, 2016

Hi,

@hamczu yes, I've been using the { stateHistoryTracker as trackHistory } as in examples when importing.

I've did a bit more research and it seems that it fails inside the trackReducerChanges:
history: Object.assign([], newAppState.stateHistory.history)

Seems like the newAppState.stateHistory is undefined but can't figure out why. It is not the versions (tried your example with latest versions and works fine), may be the redux router I'm using on the project.

Any ideas?

@JanMesaric
Copy link
Author

JanMesaric commented Jun 18, 2016

Ok if I create my own recuer called "stateHistory" I get error in the console saying:
Uncaught Error: Redux store not configured properly for <ReduxRouter>. Make sure you're using the reduxReactRouter() store enhancer.

So I'm pretty sure the redux router is the issue? Perhaps the reducer names are clashing.

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

No branches or pull requests

3 participants