Open phillipskevin opened 6 years ago
can-view-import adds the importPromise at the "end" of the scope chain as a "notContext" scope: https://github.com/canjs/can-view-import/blob/6d43973661130ba16040fe4243896c0606de741b/can-view-import.js#L41.
can-view-import
importPromise
"notContext"
This means that if you have code like this:
{{#with(app=this)}} <can-import from="~/my-footer/my-footer"> {{#if(isResolved)}} <my-footer app:from="app" /> {{/if}} </can-import> {{/with}}
This is how the scope is set up:
This means that you can't read app without doing ../app.
app
../app
If we switched the order of these scopes, you would be able to read app and you would also be able to read from importPromise because can-view-scope will walk up the scope chain if the parent is a notContext scope: https://github.com/canjs/can-view-scope/blob/06b22d097ea0ae4204f8e74947e96ddebaf2f905/can-view-scope.js#L286
can-view-scope
notContext
If this were added "above" the current scope, it would work similarly to how other notContext scopes are set up: https://github.com/canjs/can-stache/blob/master/helpers/core.js#L92-L95
can-view-import
adds theimportPromise
at the "end" of the scope chain as a"notContext"
scope: https://github.com/canjs/can-view-import/blob/6d43973661130ba16040fe4243896c0606de741b/can-view-import.js#L41.This means that if you have code like this:
This is how the scope is set up:
This means that you can't read
app
without doing../app
.If we switched the order of these scopes, you would be able to read
app
and you would also be able to read fromimportPromise
becausecan-view-scope
will walk up the scope chain if the parent is anotContext
scope: https://github.com/canjs/can-view-scope/blob/06b22d097ea0ae4204f8e74947e96ddebaf2f905/can-view-scope.js#L286