fix: stop rebuilding application if text-only changes have occurred in dev mode#1227
Merged
fix: stop rebuilding application if text-only changes have occurred in dev mode#1227
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes issue #1224 by preventing unnecessary application rebuilds when only text literals change in templ files during development mode. The changes introduce a distinction between Go code changes (which require a full rebuild) and text-only changes (which only need browser reload).
Key changes:
- Split the existing
HasChangedfunction into separateHasGoChangedandHasTextChangedfunctions - Update event handling to track Go changes and text changes separately
- Refactor the generation command structure to use errgroups for better concurrency management
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| generator/generator.go | Splits HasChanged into HasGoChanged and HasTextChanged functions |
| cmd/templ/generatecmd/watcher/watch.go | Minor cleanup removing unused variables |
| cmd/templ/generatecmd/eventhandler.go | Updates event handling to track Go and text changes separately |
| cmd/templ/generatecmd/cmd.go | Major refactoring to use errgroups and separate handling of different change types |
Comments suppressed due to low confidence (1)
cmd/templ/generatecmd/cmd.go:180
- The function name 'groupUntilNoMessagesReceivedFor100ms' contains a magic number. Consider using a constant or making the timeout configurable to improve maintainability.
func (cmd Generate) groupUntilNoMessagesReceivedFor100ms(postGeneration chan *GenerationEvent) (grouped *GenerationEvent, updates int, ok bool, err error) {
This was referenced Jul 24, 2025
Owner
Author
|
Thanks to https://github.com/philip-peterson for triggering the effort to refactor this area. |
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.
Fixes #1224, replaces #1190 and #1191.