Hot Reload
Awen watches your story assembly directory for changes and automatically reloads stories when DLLs are rebuilt.
How It Works
When --watch is enabled (the default), Awen uses two mechanisms to detect changes:
- FileSystemWatcher — monitors the
--dirdirectory for*.dllfile changes (Created, Changed, Renamed events) - Polling fallback — a 5-second interval poll that compares file write timestamps, catching changes that FileSystemWatcher may miss on some platforms
When a change is detected, Awen applies a 500ms debounce window to batch rapid successive events (common during a build), then triggers a reload.
Reload Process
On reload, Awen:
- Saves the current UI state (selected story, filter text)
- Restarts the application process with a
--restoreflag pointing to a state file - Rescans the assembly directory for updated stories
- Restores the previous selection and filter
This ensures a clean reload without stale type references from previously loaded assemblies.
Controlling Hot Reload
| Option | Effect |
|---|---|
--watch (default) | Enable hot-reload |
--no-watch | Disable hot-reload entirely |
# Hot-reload enabled (default)
Awen --dir ./stories
# Hot-reload disabled
Awen --dir ./stories --no-watch
Workflow
A typical development workflow:
- Launch Awen pointing at your stories output directory
- Edit your control or story code in your IDE
- Rebuild (e.g.,
dotnet build) - Awen detects the new DLLs and reloads automatically
- Your changes appear in the preview without restarting Awen