-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
[BUG] lifecycle callbacks called in wrong sequence for top level route. #612
Comments
This is not correct. Child element cannot have |
@bigopon right, so with 1.8.1, the behaviour is expected. I just tested by removing router from the picture. app.html <template>
<require from="./page-one"></require>
<page-one></page-one>
</template> Both 1.8.1 and 1.8.2 behaves same:
So this is likely still a router related bug. |
It's likely to be in It's a bit early compared to what we have in |
Means an easy fix for you? |
For completeness sake I should point out I've done some digging into a potentially related issue a couple months back: aurelia/templating-router#26 The most relevant bit from that topic is this visualization of the lifecycle steps when there is a 300ms promise delay between the activates of 4 nested child routers: Pay attention to the arrows:
Now the router-view 1 being first isn't necessarily weird or wrong, because that's the root. The App always gets a special treatment in the lifecycle. What I see as a problem (as @StrahilKazlachev eluded on Discord, and others may have said this as well) is first of all that binding happens inside-out, and secondly that I have a feeling this is rooted in the router pipeline, but it's hard to know for sure. Time to put vCurrent in a monorepo and write some integration tests.. x) |
Isn't this the expected behavior ? A view port (read |
Does anything guarantee that the |
I haven't had any immediately obvious fix for this atm, so the suggestion is to undo aurelia/templating#633 via following block import { CompositionEngine } from 'aurelia-templating';
CompositionEngine.prototype._createControllerAndSwap = function(context) {
return this.createController(context).then(controller => {
controller.automate(context.overrideContext, context.owningView);
if (context.compositionTransactionOwnershipToken) {
return context
.compositionTransactionOwnershipToken
.waitForCompositionComplete()
.then(() => {
return this._swap(context, controller.view);
})
.then(() => controller);
}
return this._swap(context, controller.view).then(() => controller);
});
} and avoid using |
@bigopon why? Where is the code path that calls Edit: Scratch the above, so there is a |
The fix at aurelia/templating#633 pushes app root The way the root router & child router work, though may be not nice ( For StrahilKazlachev/templating-router@c54c706, Very nice solution, it also fixes the issue with What the behavior is like with @StrahilKazlachev 's solution ( Though I cannot get it to work with child router without bringing back behavior of Though I'm not confident we can fix the inside out behavior without a version bump. cc @EisenbergEffect @fkleuver @davismj @huochunpeng |
@bigopon my "solution" did lock the app startup with |
Hi there!! I'm having this exact same issue... any news on it? Cheers :) |
@jvlobo unfortunately the team has decided to live with this bug at the moment. This is one of domino bugs, created by a chain of patches to fix some other nasty bugs. Comparing to other bugs, this one is the least serious one. We are bit lazy here, or should I say bit scared to create another new bug with another patch :-) Don't worry, vNext will cleanup all of them :D (@fkleuver sweating heavily when reading this) |
I've been having a lot of bugs recently with some of the updates :( |
@jvlobo sorry to hear that. Could you post some code to discourse forum so folks can help? |
Where is the discourse forum? Thanks! |
Man, on aurelia home page :-) https://discourse.aurelia.io |
@huochunpeng vNext won't need to clean any of this up since the new core framework will make it much simpler to achieve the same things. Timing related issues will be pretty much nonexistent. I'm not sweating at all :) |
I'm submitting a bug report
Library Version:
all
It is a regression caused by aurelia-templating v1.8.2.
But I am pretty sure this is a router bug (whether the buggy code is in this repo, I am not sure), the new aurelia-templating fix just made this router bug appears even worse.
Operating System:
OSX 10.13
Node Version:
8.11.3
NPM Version:
6.2.0
JSPM OR Webpack AND Version
NA
Browser:
all
Language:
all
Current behavior:
https://github.com/huochunpeng/router-bug2
app.js has one level router config with two pages (page-one.js and page-two.js), here is the log of lifecycle callbacks
with aurelia-templating 1.8.1 (with or without bluebird)
note bind() is in right order,
but attached() is not (page-one should be attached before app)with aurelia-templating 1.8.2 (with or without bluebird)
bind() is in wrong order,
plus wrong attached() orderDue to the wrong bind() call sequence, the page-one now doesn't get correct inherit overrideContext from app.
User has reported missing variable (defined in top app.js) in router loaded component view template.
https://discourse.aurelia.io/t/using-require-breaks-router/1411/31?u=huochunpeng
This bug is related to #548, which can be fixed by #571. But that fix only fix lifecycle callbacks for nested route, not the top route (as top route is not delayed).
Expected/desired behavior:
No matter what aurelia-templating version in use, our sequence is NOT right.aurelia-templating v1.8.2 made this bug even worse, and more noticeable to end user.What is the expected behavior?
What is the motivation / use case for changing the behavior?
The user experienced missing variable (due to missing overrideContext) is not the bug we want to fix.
The wrong lifecycle callback sequence is the bug to be solved.
cc @bigopon @davismj @EisenbergEffect
aurelia-templating v1.8.2 just killed off everyone (intentionally or unintentionally) rely on the default inheritBindingContext behaviour of router loaded component.
The text was updated successfully, but these errors were encountered: