fix: handle live import declaration changes in lazy loader#1192
Merged
fix: handle live import declaration changes in lazy loader#1192
Conversation
mnoah1
approved these changes
Jun 13, 2025
Contributor
Author
joerdav
requested changes
Jun 23, 2025
Collaborator
joerdav
left a comment
There was a problem hiding this comment.
I left a very small nit, but besides that it looks good to me. I tested this out on my small bazel project, but I assume you guys have done some testing too?
Contributor
Author
|
Thanks for the review! We've done thorough testing internally. Were you able to get it working on your Bazel project? This works well for us, and while there are performance optimizations we could make, our current focus is just getting something functional 🙂. |
Collaborator
|
Yes thanks, appears to be working on my example Bazel project. I get completions once when a new import is added. |
joerdav
approved these changes
Jun 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Note: To support this change, we refactored the existing lazy loader, including moving it into its own internal package. Please let me know if the PR feels too large to review; I’m happy to split it up. That said, most of the diff is from unit tests; the actual logic changes are minimal.
Synchronize the lazy loader with changes to the import section of a templ file. When the imports in a file change (e.g. new or removed dependencies), we now correctly:
This ensures that the loader maintains a consistent set of open templ files in response to live edits to import declarations, and avoids broken import-related bugs.