-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
Clean up boot process #10271
Clean up boot process #10271
Conversation
@@ -256,28 +256,27 @@ var Application = Namespace.extend(DeferredMixin, { | |||
init: function() { | |||
this._super(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this._super.apply(this, arguments);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. This code is not in a change in this commit.
@rwjblue asked for a diagram of this change, thought it might be useful for others. |
This is the beginning of a refactor that improves the clarity and explicitness of the Application boot process. In particular, it takes advantage of the previous ApplicationInstance refactoring, and explicitly exposes boot phases via promises. The end-game here is to allow FastBoot to boot up an application but not create an application instance, and allow individual FastBoot requests to create instances on demand. This will also help the testing infrastructure, which also wants to boot an application once for the entire test suite, and create an instance for each test run.
Shout out to @rwjblue
This test had its heart in the right place, but the semantics it actually exercises are unimportant and simply tested the side-effects of a previous implementation. To wit, this test sets the application’s location to `none`, yet still expects the application’s `rootURL` to be injected on _any_ arbitrary location looked up via the container. Under the hood, the router registered a private (dash-prefixed) injection, so we feel confident we can refactor the internal implementation without breaking any apps. In short, this test was testing the side-effects of a private injection, which we are eliminating, while retaining the public API it supported.
A registry's fallback registry resolves registrations and injections when no matches can be found.
The instance's registry sets its fallback to the corresponding application's registry.
Ensure that `name` and `type` are valid after initial parsing and before any post-parsing mutations might be performed. This fixes a problem in which mutations are performed to the cached object (e.g. "route:basic" -> "route:") and then the validation of the mutated object fail when it's accessed a second time. It's also more efficient, since validation only occurs once.
// decremented by the Application's own `initialize` method. | ||
this._readinessDeferrals = 1; | ||
|
||
if (!Ember.FEATURES.isEnabled('ember-application-visit') || this.autoboot) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feature flag system cannot handle this properly.
It must be precisely:
if (Ember.FEATURES.isEnabled('ember-application-visit')) {
/* stuff when enabled */
} else {
/* stuff when disabled */
}
This refactor improves the clarity and explicitness of the Application boot process. In particular, it takes
advantage of the previous ApplicationInstance refactoring, and explicitly exposes boot phases via promises.
The end-game here is to allow FastBoot to boot up an application but not create an application instance, and allow individual FastBoot requests to create instances on demand via the
visit()
API.This will also help the testing infrastructure, which also wants to boot an application once for the entire test suite, and create an instance for each test run.