Repository navigation
feat: hot-reload component files without server restart - #1657
Merged
Merged
Conversation
When a component's template, JS, or CSS file changes on disk, the dev server now picks up the change on the next request without restarting. This matches how standard Django templates already work. Changes the `reload_on_file_change` setting from `bool` to support `"off"` | `"hot"` | `"restart"` (plus bool for backward compat). Default is now `"hot"` (was `False`). Closes #1324 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Replace autoref-style [text][Key] links with relative markdown links in development_server.md (master uses this format, not autorefs) - Fix stale anchor #reload-dev-server-on-component-file-changes to match renamed heading #hot-reloading-component-files-during-development - Add ReloadMode entry to docs/reference/api.md (gen script is broken) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
Performance Benchmark ResultsComparing PR changes against master branch: Benchmarks that have stayed the same:
|
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
Performance Benchmark ResultsComparing PR changes against master branch: Benchmarks that have stayed the same:
|
Contributor
Performance Benchmark ResultsComparing PR changes against master branch: Benchmarks that have stayed the same:
|
Tests used fake Unix paths like "/some/tracked/template.html" which Path.resolve() transforms differently on Windows (prepends drive letter). Use real temp files instead so paths resolve consistently cross-platform. Also suppress pre-existing mypy call-arg error on pydantic BaseSettings (reads required fields from env vars, which mypy can't verify). Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
Performance Benchmark ResultsComparing PR changes against master branch: Benchmarks that have stayed the same:
|
Contributor
Performance Benchmark ResultsComparing PR changes against master branch: Benchmarks that have stayed the same:
|
Merged
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.
Summary
template_file,js_file, orcss_filechanges on disk, the dev server now picks up the change on the next request without restarting. This matches how standard Django templates already work.reload_on_file_changesetting fromboolto support"off"|"hot"|"restart"(plusboolfor backward compat). Default is now"hot"(wasFalse)."restart"mode is deprecated and markedTODO_REMOVE_IN_V1.How it works
_component_file_cache) maps absolute file paths to component classes (weakrefs).file_changedsignal, we look up affected components and clear theirComponentMediacache + the dependency rendering cache.Trueto suppress Django's server restart (in"hot"mode)._load_media().Files changed
app_settings.py-ReloadModeenum, updated setting type/default/normalizercomponent_media.py- reverse index,reset_template(),reset_files()dependencies.py-evict_component_scripts()to clear the dependency rendering cacheapps.py-_setup_component_file_reload()signal handler__init__.py- exportReloadMode,ReloadModeTypeutil/testing.py- test cleanup for the new cachetests/test_hotreload.py- 24 tests covering all scenariosCloses #1324
Closes #1461
Test plan
test_hotreload.py(template/JS/CSS reload, multiple components sharing a file, signal suppression in hot mode, restart mode, off mode, weakref cleanup)pytest,ruff,mypy)🤖 Generated with Claude Code