Skip to content
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

Config flag to stop template from local resolution #17

Merged
merged 1 commit into from
Jul 2, 2017

Conversation

mixonic
Copy link
Member

@mixonic mixonic commented Jul 1, 2017

  • Add disableLocalResolutionForTypes to the config, permits a type to block being locally resolved in a given collection.

edit: This summary is out of date. See #17 (comment)

@mixonic
Copy link
Member Author

mixonic commented Jul 1, 2017

Adds two tests:

},
collections: {
routes: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we add types in the routes collection?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes thank you, adding this.

@mixonic mixonic force-pushed the template-lookup branch 4 times, most recently from 5916eac to 501e44a Compare July 1, 2017 22:34
 - Ensure a type only specifier does not fall back to a global resolution
 - Only look for a local lookup in the definitive collection
@mixonic
Copy link
Member Author

mixonic commented Jul 1, 2017

Ok, the approach her has changed. Two semantic differences land here:

  • First, if you resolve with only a type ('type', not 'type:name') then no resolution fallback steps will run. The type will be looked for only in namespace and collection of the referrer. This is useful for local lookup, and to force the collection of a global lookup (From Ember we call resolve('template', 'route:/app/routes/my-page') to force a template lookup in the routes collection).
  • Second, local lookup will only occur for a type if the collection is that type's definitiveType. In Ember this ensures resolve('template:my-page', 'template:/app/routes/my-form') does not resolve a module at template:/app/routes/my-form/my-page.

Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems much better than the original flag. We should continue thinking of a better long term solution (or disambiguate better in Ember itself).

@mixonic
Copy link
Member Author

mixonic commented Jul 2, 2017

One reason you might call this less than ideal is that resolve('template', 'route:/app/routes/my-page') implies you must have a second type (here route) in the routes collection in order to force lookup to a template in that collection. It might be better if resolve('template', ':/app/routes/my-page') without a type on the referrer was permitted.

@mixonic mixonic merged commit bad8f28 into master Jul 2, 2017
@mixonic mixonic deleted the template-lookup branch July 2, 2017 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants