Skip to content
This repository has been archived by the owner on Oct 26, 2018. It is now read-only.

Officially document @@router/LOCATION_CHANGE #298

Closed
StephenCleary opened this issue Feb 23, 2016 · 9 comments
Closed

Officially document @@router/LOCATION_CHANGE #298

StephenCleary opened this issue Feb 23, 2016 · 9 comments

Comments

@StephenCleary
Copy link

I do have a use case for @@router/LOCATION_CHANGE: I have to show one element on my page after all other elements have completed loading (asynchronously). For this, I have a boolean flag in my state that is set to false on @@router/LOCATION_CHANGE and set to true by another action when all the elements have completed loading.

Please export a constant like what used to be done with UPDATE_LOCATION, so that I can use an officially documented action rather than a magic string.

@oande
Copy link

oande commented Feb 23, 2016

Maybe I'm misunderstanding, but isn't it exported already?
https://github.com/reactjs/react-router-redux/blob/master/src/reducer.js#L5

(Although I agree some additional documentation wouldn't hurt.)

@StephenCleary
Copy link
Author

Yup, I didn't even see it there. It changed names since 3.0.0, and the old one didn't work, and the new one isn't documented, so I just assumed it wasn't being exported anymore.

@gaearon
Copy link
Member

gaearon commented Feb 23, 2016

PRs to the docs are welcome 😉

@gaearon
Copy link
Member

gaearon commented Feb 23, 2016

The name changed because the behavior changed. The previous action used to fire before the history was requested to change via action creators. The new action is fired after any history change, and regardless of how it’s done (e.g. browserHistory.push() will work too).

@StephenCleary
Copy link
Author

Interesting. I wasn't using the action creators directly; I would see that action come through when clicking on a router <Link>.

@gaearon
Copy link
Member

gaearon commented Feb 23, 2016

Oops. I looked it up and you’re right, it did work this way before as well.

@timdorr
Copy link
Member

timdorr commented Feb 23, 2016

Interesting use case. Could you hook into those async actions with a callback on the component that gets called when they complete? That could be useful for components that aren't tied to a URL (such as a modal or something). Just another suggestion.

I can get to this soon. But if someone wants to beat me with a PR, go for it! 😄

@dandelany
Copy link
Contributor

Beat you to it :) lemme know if I missed anything.

@timdorr timdorr closed this as completed Feb 24, 2016
@SimplyY
Copy link

SimplyY commented Mar 20, 2016

Oh I see it has something can be improved in doc. Because it(LOCATION_CHANGE) changed names since 3.0.0(in this year), so doc should show it.

I edit it and add PR. in #334

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

6 participants