Allow app property to pass through addon proxy to addon instance #9936
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.
When the EmberApp constructor runs, the presence of nested addon dependencies can result in the
project.addons
list containing a mixture of addon instances and addon proxy objects. For the addon proxy objects, the EmberApp setting theirapp
property would prevent the addon instance from having it set, which goes against the expectation described in the models/addon.js app property comment:ember-cli/lib/broccoli/ember-app.js
Line 132 in ee6d372
ember-cli/lib/models/addon.js
Lines 188 to 193 in ee6d372
Later on, when an addon attempts to read
this.app
it will be undefined if the addon was a Proxy by the time the EmberApp constructor method attempted to set it. This seems like a bug.The comment explaining the proxy holding the app claims that ember-cli might set that app property, but I'm not sure what situation it is referring to. I didn't see any test coverage of this behavior. Simply removing this fixes the issue where addons in my project that expect to be able to read
this.app
in their index.js functions were erroring.