Hot Reloading - Live UI Updates for Anchor Program Changes
Overview
Section titled “Overview”Hot Reloading keeps your testing UI synchronized with your Solana program code. When you make changes and rebuild your program, Testship automatically detects the updates and refreshes the interface - no manual restarts required.
How It Works
Section titled “How It Works”Automatic Detection
Section titled “Automatic Detection”Testship watches for changes to:
- Your program’s IDL file (
target/idl/*.json
) - Program binary (
target/deploy/*.so
) - Anchor configuration (
Anchor.toml
) - Account type definitions
When you run anchor build
, Testship:
- Detects the IDL has changed
- Parses the new interface definition
- Updates the UI to match
- Preserves your current session state
Seamless Updates
Section titled “Seamless Updates”The hot reload process is smooth:
- UI updates without page refresh
- Form inputs are preserved where possible
- Account suggestions remain available
- Transaction history is maintained
Development Workflow
Section titled “Development Workflow”Traditional Workflow (Without Testship)
Section titled “Traditional Workflow (Without Testship)”- Make code changes
- Run
anchor build
- Close test script
- Restart test environment
- Reconfigure test accounts
- Re-enter test parameters
- Execute test
- ⏱️ 5-10 minutes per iteration
With Hot Reloading
Section titled “With Hot Reloading”- Make code changes
- Run
anchor build
- UI updates automatically
- Continue testing
- ⏱️ 30 seconds per iteration
Features
Section titled “Features”Intelligent UI Updates
Section titled “Intelligent UI Updates”Testship smartly handles different types of changes:
New Instructions
- Automatically appear in the sidebar
- Form generated instantly
- Ready to test immediately
Modified Instructions
- Updated parameter fields
- Changed account requirements reflected
- Previous inputs adapted when possible
Removed Instructions
- Gracefully removed from UI
- Warning if currently selected
- Redirect to main view
Type Changes
- Updated input validation
- New enum options
- Modified struct fields
State Preservation
Section titled “State Preservation”During hot reload, Testship preserves:
- Connected wallet
- Selected network
- Account suggestions list
- Transaction history (up to reload)
- Favorite accounts
- UI preferences
Change Notifications
Section titled “Change Notifications”Stay informed with:
- Toast notification on successful reload
- Summary of changes detected
- Warning for breaking changes
- Error messages if reload fails
Configuration
Section titled “Configuration”Watch Options
Section titled “Watch Options”Configure what triggers reloads:
[hot_reload]enabled = truewatch_idl = truewatch_types = trueauto_reload_ui = truepreserve_state = true
Selective Reloading
Section titled “Selective Reloading”Choose reload behavior:
- Full Reload: Complete UI refresh
- Partial Reload: Update only changed parts
- Manual Reload: Prompt before reloading
- Background Reload: Update without interruption
Debouncing
Section titled “Debouncing”Prevent excessive reloads:
- Wait for build completion
- Batch multiple file changes
- Configurable delay after changes
Advanced Features
Section titled “Advanced Features”Multi-Program Projects
Section titled “Multi-Program Projects”For workspaces with multiple programs:
- Track changes to all programs
- Switch between program UIs
- Maintain separate sessions
- Hot reload each independently
Program Upgrades
Section titled “Program Upgrades”When deploying updates:
- Detect program address changes
- Update IDL references
- Maintain account mappings
- Warn about breaking changes
Version History
Section titled “Version History”Track your testing across versions:
- See which program version was used
- Compare behavior across versions
- Rollback UI to previous program version
- Useful for debugging regressions
Error Recovery
Section titled “Error Recovery”If hot reload fails:
- Clear error message
- Suggestion for manual refresh
- Automatic retry
- Rollback to last working state
Notifications
Section titled “Notifications”Change Types
Section titled “Change Types”Different notifications for different changes:
✅ Non-Breaking Changes
- New instructions added
- New optional parameters
- Documentation updates
- Minimal notification
⚠️ Breaking Changes
- Removed instructions
- Changed parameter types
- Modified account structure
- Prominent warning
❌ Errors
- IDL parse failure
- Invalid program changes
- Build errors
- Action required
Notification Settings
Section titled “Notification Settings”Customize notification behavior:
- Toast messages
- Desktop notifications
- Sound alerts
- Browser tab title updates
Use Cases
Section titled “Use Cases”Rapid Prototyping
Section titled “Rapid Prototyping”Iterate quickly on program design:
- Add new instruction
- Build
- Test immediately
- Refine based on results
- Repeat
Bug Fixes
Section titled “Bug Fixes”Fast debug cycle:
- Identify issue in testing
- Fix code
- Build
- Verify fix instantly
- No setup needed
Feature Development
Section titled “Feature Development”Smooth feature addition:
- Implement new feature
- Build
- Test UI appears automatically
- Validate with real transactions
- Iterate rapidly
Learning & Exploration
Section titled “Learning & Exploration”Experiment with Solana concepts:
- Modify program parameters
- See effects immediately
- Understand relationships
- Build intuition faster
Performance
Section titled “Performance”Hot reloading is optimized for speed:
- IDL Parsing: < 100ms
- UI Generation: < 500ms
- State Migration: < 200ms
- Total Reload Time: ~1 second
Network Impact
Section titled “Network Impact”Minimal network usage:
- Only IDL file monitored (KB-sized)
- No unnecessary on-chain queries
- Efficient file watching
- Configurable polling interval
Troubleshooting
Section titled “Troubleshooting”Hot Reload Not Working?
Section titled “Hot Reload Not Working?”Check these common issues:
-
IDL not updating
- Ensure
anchor build
completes successfully - Check
target/idl/
directory exists - Verify file permissions
- Ensure
-
UI doesn’t refresh
- Check if hot reload is enabled
- Look for error notifications
- Try manual refresh
-
State lost after reload
- Check
preserve_state
setting - Some breaking changes can’t preserve state
- Session sharing maintains state
- Check
Manual Override
Section titled “Manual Override”Force a reload:
- Press Ctrl+R (or Cmd+R on Mac)
- Click “Refresh UI” button
- Restart Testship completely
Best Practices
Section titled “Best Practices”During Development
Section titled “During Development”- Keep Testship running continuously
- Build frequently to catch errors early
- Review change notifications
- Use version history for big changes
For Teams
Section titled “For Teams”- Share sessions with hot reload enabled
- Document program version with each test
- Use session snapshots before breaking changes
- Enable desktop notifications for collaborators
Coming Soon
Section titled “Coming Soon”Planned enhancements:
- Hot reload for program upgrades
- Visual diff of IDL changes
- Automatic test re-execution
- Change impact analysis
- CI/CD integration
Next Steps
Section titled “Next Steps”Explore the roadmap feature Export to Tests to see how Testship will integrate with your CI/CD pipeline.