Skip to content

Encourage decentralizing the template registry for Ember projects #67

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

Merged
merged 2 commits into from
Mar 17, 2021

Conversation

dfreeman
Copy link
Member

While the centralized registry approach is nice in that it's something we could more easily automate generating, it really doesn't play nicely with TS's internal dependency tracking and cache invalidation, leading to some bizarre behavior with glint --watch and, I discovered more recently, glint-language-server if you don't happen to have the registry document open in your editor.

For now, we can instead suggest augmenting the registry inline in each module that exports a template entity. Aside from avoiding the invalidation errors, this also has the nice side effect of bringing you to the actual source module when you go-to-definition from a template.

@dfreeman dfreeman added the documentation Improvements or additions to documentation label Mar 17, 2021
Copy link
Member

@jamescdavis jamescdavis left a comment

Choose a reason for hiding this comment

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

That's interesting about the centralized registry not playing nice with TS's dep tracking and cache invalidation. TBH, this approach feels more natural to me when populating the registry manually (which is why I did it with these demo components originally 🙂 ). I guess it's all those years of adding ember-data models to the registry at the bottom of each. I do like that go-to-def always gets you to the right file with this approach.

@dfreeman dfreeman merged commit e059e35 into master Mar 17, 2021
@dfreeman dfreeman deleted the decentralize-registry branch March 17, 2021 14:09
@chriskrycho
Copy link
Member

👍🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants