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

Skip very first @@router/LOCATION_CHANGE #439

Closed
rybon opened this issue Aug 18, 2016 · 8 comments
Closed

Skip very first @@router/LOCATION_CHANGE #439

rybon opened this issue Aug 18, 2016 · 8 comments

Comments

@rybon
Copy link

rybon commented Aug 18, 2016

When starting the app, this dispatch is always fired:

{
    "type": "@@router/LOCATION_CHANGE",
    "payload": {
        "pathname": "/",
        "search": "",
        "hash": "",
        "state": null,
        "action": "POP",
        "key": null,
        "query": {},
        "$searchBase": {
            "search": "",
            "searchBase": ""
        }
    }
}

Is there a way to turn that off? I tried adjustUrlOnReplay: false, but I still see this dispatch happening. In a test environment I want the app to be inert, in other words not trigger a dispatch on its own, so I can feed it recorded dispatches later on. Is that possible?

@dlmr
Copy link
Contributor

dlmr commented Aug 18, 2016

I believe this is related to #412.

I know what is causing it and actually have what I believe is a correct fix for it locally but I have not yet had time to write good enough tests as requested in #412. Maybe I should push it to PR so others can contribute and maybe help with the test aspects.

@slowsay
Copy link

slowsay commented Aug 24, 2016

you should be disposed combineReducers({function,function})

@rybon
Copy link
Author

rybon commented Aug 24, 2016

@dlmr feel free to publish your PR.

@dlmr
Copy link
Contributor

dlmr commented Aug 26, 2016

@rybon I have pushed my PR as #445 but I think I misspoke unfortunately.

It is correct that a LOCATION_CHANGE is dispatched on initial render. The reason for this is because there currently is no other way for the store to be initialised with the correct information, that is the correct representation of the what the browser URL is and this will be different each time since history is using a random key to make the location unique.

@chrisabrams
Copy link

I wish this fired for me on page load. I have to make a page change before seeing this.

@dlmr
Copy link
Contributor

dlmr commented Aug 27, 2016

@chrisabrams If you are using SSR the change in #445 will "fix" that.

@chrisabrams
Copy link

@dlmr got it; will look forward to the "fix"

@timdorr timdorr closed this as completed Sep 22, 2016
@pipi32167
Copy link

pipi32167 commented Mar 23, 2017

Still have the same problem, not using SSR.

I use redux-devtools and redux-devtools-extension to debug, and find out the last action like this:

image

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