-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
When route path matches getChildRoutes should be called right away #3852
Comments
You should be using |
No, please look again. I have specifically pointed out the difference in behavior of
If setup is synchronous everything works, if setup is async |
Yeah, looks like you're right. Sorry about the quick closing. |
is there any idea how to fix this? |
Any updates? It's 4 weeks since it was created... |
Our limited time to work on this is focused on v4, but we will happily merge a pull request to correct this behavior. |
This is open source, so you are just as responsible as us to have done something in the last four weeks 😉 |
If only I knew where to look at least :) any suggestions? I am totally fine to make a PR. |
I haven't been in that code in a long time, I'd drop a debugger in your |
if I remember right, it's probably somewhere in "transition manager" |
OK, I'll take a look. Basically the issue boils down to a place when async getChildRoutes should be loaded if previous URL portion matches, e.g. when route is |
Actually, you'll want to look here: https://github.com/ReactTraining/react-router/blob/v3/modules/matchRoutes.js If you want to do a PR (which would be great!), you should do so against the v3 branch since it's technically a behavior change and should go into the next major anyways. |
I've updated my setup to 3.0.0 but the behavior is still the same. |
I confirm that bug is not reproduced on 3.0.2. Updated setup: http://jsbin.com/cidojibijo/5/edit?js,console,output |
There is a difference in
getChildRoutes
vschildRoutes
behavior. IndexRoutes along the way are expected to be used even if they belong to "empty" path sub-routes, which is true forchildRoutes
and does not work when routes are asynchronously loaded viagetChildRoutes
.Version
2.8.1
Test Case
http://jsbin.com/xajuyoj/5/edit?js,console,output
Steps to reproduce
Click "Feed", then click "Feed 1"
Expected Behavior
When "Feed" is clicked
getChildRoutes
is expected to be loaded (because route matches/feed
), index page supposed to be displayed.Actual Behavior
getChildRoutes
is not loaded when "Feed" is clicked.getChildRoutes
is called only when route becomes/feed/1
, e.g. when "Feed 1" is clicked.If sync
childRoutes
is used the behavior is correct.PS
The rationale is to offload the entire sub-tree (incl. index route and route with params) into a code split point. Seems that right now the only option is to separately offload index route and child routes, there's no way to put them both in one chunk.
The text was updated successfully, but these errors were encountered: