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

isFirstRendering always false #259

Closed
AlexeyAbretov opened this issue Feb 20, 2019 · 4 comments
Closed

isFirstRendering always false #259

AlexeyAbretov opened this issue Feb 20, 2019 · 4 comments

Comments

@AlexeyAbretov
Copy link
Contributor

in actions.js the method onLocationChanged has the parameter isFirstRendering but the method onLocationChanged from ConnectedRouter.js does not send a value.

actions.js
export const onLocationChanged = (location, action, isFirstRendering = false) => ({
type: LOCATION_CHANGE,
payload: {
location,
action,
isFirstRendering,
}
})

ConnectedRouter.js
const mapDispatchToProps = dispatch => ({
onLocationChanged: (location, action) => dispatch(onLocationChanged(location, action))
})

@supasate
Copy link
Owner

supasate commented Mar 3, 2019

What the bug does it cause?

Basically, it's intended to be false except only for the first time here.

@AlexeyAbretov
Copy link
Contributor Author

AlexeyAbretov commented Mar 4, 2019

We use SSR in our apps.

We cannot determine the first LOCATION_CHANGE on client.

This needed to prevent get data on client because they received on server.

@ufukomer
Copy link

ufukomer commented Mar 5, 2019

I don't use SSR but it is always false for me too. I've integrated connected-react-router with create-react-app.

@supasate
Copy link
Owner

supasate commented Mar 5, 2019

@AlexeyAbretov I re-read the code again and you're right. It's obviously a bug. The 3rd argument is passed from handleLocationChange, but, it is not forwarded to the onLocationChange props. I'm merging your PR.

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