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

Help needed #768

Closed
jean-Phil opened this issue Mar 27, 2016 · 13 comments
Closed

Help needed #768

jean-Phil opened this issue Mar 27, 2016 · 13 comments

Comments

@jean-Phil
Copy link

Hello Erik,

I apologize in advance: this should not be an issue, but a request for help, however I don't know how else to get in touch with you.

I've managed to build a simple two-page app ( list and form view ) which would do what I intended it to. However, I am experiencing difficulties with action calls having undesired effects, and I've really spent too much time trying to debug this... I've reached the stage where I need someone more experienced to look at my code and provide guidance...

Between @@router/LOCATION_CHANGE and redux-form/DESTROY action calls, I am getting 'Uncaught TypeError: Cannot read property 'type' of undefined' and I don't seem to be able to fix this. I've searched for similar issues eg. https://github.com/reactjs/react-router-redux/issues/182 but cannot wrap my head around the problem.

I am obviously more than willing to compensate you for your time. Please let me know if you could find time to help me solve this. I believe an hour may be sufficient.

Thank you in advance!

JP

@erikras
Copy link
Member

erikras commented Mar 28, 2016

Unfortunately, I don't have near the experience that I'd like to have with react-router-redux, as I have not yet found the time to integrate it into my project(s). You need to isolate exactly where the error is occurring, with an exception breakpoint or a sprinkling of console logs. My guess is that it's somewhere in the react-router-redux middleware, where somehow an undefined action is getting dispatched.

That's about all I can tell you without seeing (and running) your source code.

@jean-Phil
Copy link
Author

Thank you Erik!
I would have a few questions regarding redux-form as well. Would you be available for a quick guidance session?

If so, please let me know how I can get in touch with you. My email is on my github homepage, would you want to reach me.

Thank you!

@jljorgenson18
Copy link

I'm using react-router-redux and redux-form and haven't had any issues yet. Feel free to post a snippet of the form and maybe I can help

@jean-Phil
Copy link
Author

Thank you, Jesse! I really appreciate you stepping forth.

I've uploaded the code to https://github.com/jean-Phil/redux-form-navig-issue/, and put my goals and the bugs I encounter in the readme file.

@erikras
Copy link
Member

erikras commented Mar 28, 2016

When I fill out the required fields and hit "Submit", I'm getting this.
localhost 3000 formundefined _k 43d2xd6 2016-03-28 17-27-31

@jean-Phil
Copy link
Author

Hello Erik, Thank you for having a look already.

The message part of state is not fully implemented yet. For now, I've pushed a new version, to solidify and clarify that part of the updateMessages fn. It did not seem to throw on my end.

@erikras
Copy link
Member

erikras commented Mar 28, 2016

Okay, now I'm not seeing any exceptions. It's dispatching ADD_UNSAVED_CHANGES, but no react-router-redux actions. Perhaps record a little screencast of how you are recreating it?

@jean-Phil
Copy link
Author

At this point, it is not navigating automatically back to the /list route. If you want to recreate navigation on your end, you must first clear away the "undefined" from the url, and a button will appear, allowing you to navigate to the other view.

eg.

FROM events-list-and-form/client/index.html#/formundefined?_k=43d2xd6
TO events-list-and-form/client/index.html#/form?_k=43d2xd6

or

FROM events-list-and-form/client/index.html#/listundefined?_k=43d2xd6
TO events-list-and-form/client/index.html#/list?_k=43d2xd6

@jljorgenson18
Copy link

So a few things.

If you want to use the react-route-redux actions, you need to add the routerMiddleware. This allows the dispatched history actions to actually change the history

const finalCreateStore = applyMiddleware(
    thunk,
    routerMiddleware(hashHistory)
)(createStore);

The actual actions you are trying to dispatch can just be grabbed directly from the react-router-redux module. For example, you can get the "push" action

const {push} = require("react-router-redux");

And then dispatch it. For sake of debugging, try doing the simple case of transition without query or state

dispatch(push("/form"));

You do not need to reference the actual history object to dispatch the action with the newest version of react-router-redux.

@jean-Phil
Copy link
Author

That did the trick, indeed! ... and now initialization and form destruction seem to work fine as well.
Thanks so much to you both!
Erik, is it relevant to keep the code up or should I get rid of the repo I just created? Thank you for sharing that library. It's very well thought out and I've learned a great deal from your code.
Cheers!

@erikras
Copy link
Member

erikras commented Mar 28, 2016

You can 💀 it. Glad we could help. Happy coding!

@jljorgenson18
Copy link

Glad to help and glad its working

@lock
Copy link

lock bot commented Jun 3, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2018
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

3 participants