Match initial route before stores are called #681
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello choo croo, I just made a store that needs to get a URL param from
state.params
- I was only able to get it after theDOMContentLoaded
event, which I thought was a bit weird.Basically, when I navigate to
/thingy/foo
, I'd like to do this:I see no reason why I shouldn't be able to access the route info directly in the store - as far as I can tell, it doesn't interfere with any of the other things that happen on initial render.
This change just moves the
this._matchRoute
call inChoo.start
&Choo.toString
above the initial stores call.I've added tests for
state.params
&state.href
being set in the store, and also checked the expected behavior in my store :)