Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
route-href binding too late #46
I'm submitting a bug report
Please tell us about your environment:
Then after a refresh:
So I tried to force step 3. to come after step 4. by moving
I've made a minimal repro here:
You can see the difference by clicking
I don't know if moving
@fkleuver I don't think there are any really issues from moving it to attached. I would be interested to find out why this is necessary. I'm wondering if there's something wrong elsewhere that is causing this. Are you interested in investigating further? If not, would you at least be willing to submit a PR for the timing change in the route-href attribute?
@EisenbergEffect Interesting.. I think I found the problem:
Here's where it goes wrong:
This is generally not a problem because with one-by-one navigation the router is always "one ahead" of the viewmodel. However, when directly navigating to the full url the nested routes are all loaded at once and then this race condition pops up. It happens consistently for all child routes which are nested more than 2 levels deep.
Furthermore, simply wrapping
That being said, I don't think it's
What's your opinion on this?
Good analysis. Thanks for taking the time to look into that. In the worst case, we can delay the href set until attached. That's not a huge deal. Ideally, we want to delay route generation until right after the base url is fixed. Maybe we can introduce a hook for this. We might just use attached in the short term and then switch to another mechanism in the future. I need to consider it more...
Hm, that brought me on a different idea. I tried using the BindingEngine to subscribe to changes to
The only two downsides I can think of are the added dependency on
referenced this issue
Dec 7, 2016
@fkleuver @EisenbergEffect Do you guys know if this issue is blocked on a decision? I agree with @fkleuver's assessment that the router's commit step happening at the end of the lifecycle is the underlying issue. Since that's fairly involved to change at this point it would be great to work around the issue in route-href to at least get some people unblocked. What do you guys think of simply delaying the generation as Rob suggests, pending further discussions? I can help out with this if needed (but it sounds like there may already be a couple alternatives implemented already?)