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

Callbacks error on server side rendering #36

Closed
mauricioklein opened this issue Nov 28, 2016 · 3 comments
Closed

Callbacks error on server side rendering #36

mauricioklein opened this issue Nov 28, 2016 · 3 comments

Comments

@mauricioklein
Copy link

mauricioklein commented Nov 28, 2016

Hello!

I'm facing a strange behavior:
My server side rendering is being made correctly but, for some reason, the callback is not being triggered.

Everytime I click on my link, instead calling the callback method passed as props, it's triggering a @@redux/INIT and @@router/LOCATION_CHANGE. But my link is something like:

<a href="#" onClick={() => this.props.myCallback(argument)}></a>

This works well when SSR is disabled.

Also, all the promises defined in @asyncConnect are re-run when I click on the link above.

Any idea why is this happening?

Thanks!

@mauricioklein mauricioklein changed the title Callbacks lost after server side rendering Callbacks error on server side rendering Nov 28, 2016
@mauricioklein
Copy link
Author

@bertho-zero Do you have an idea why is this happening?
I've read the async connect documentation but got no clue about this.
Thanks!

@bertho-zero
Copy link
Owner

Hi,

If you want to use a link with an onClick you must first make an e.preventDefault.

This behavior is never performed on the server side, the link can not be clicked (except manually) on the server side.

@mauricioklein
Copy link
Author

Prevent default worked as expected.
Thanks @bertho-zero 👍

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

2 participants