Refactor route to lookup controller for QPs. #15178
Merged
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.
Previously, the
_qp
computed property attempted to access properties off of thedefinedControllerClass.proto()
. We even specifically intended to support accessing other computed properties or injected services to share query param values on. Unfortunately, this entire system relied on the old (and deprecated) double extend that was done bylookupFactory
(because CPs and service injections all may need access to injections likeowner
). Whenember-no-double-extend
was introduced a "backdoor" was added to allowRoute#_qp
to use a non-deprecated version of.lookupFactory
.The original version of
_qp
usedResolvedController.proto()
for two reasons:.proto()
is causing more trouble (and likely more costly) than its worth.model
was, we would instantiate a different controller base class). The controller base class no longer changes based on themodel
hook of the route (and hasn't for all of 2.0.0), so that concern is moot.This change, makes accessing
_qp
instantiate the controller instances (without the costly double extend), and simply accesses values on them. Ultimately, this will force controllers to be instantiated earlier than previously (though there were no guarantees on when they would be instantiated). This instantiation should be cheaper than forcing the double extend for these controllers, and it makes_qp
much less brittle since it is now using a standard public API.