Skip to content

Hot Reloading - Live UI Updates for Anchor Program Changes

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.

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:

  1. Detects the IDL has changed
  2. Parses the new interface definition
  3. Updates the UI to match
  4. Preserves your current session state

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
  1. Make code changes
  2. Run anchor build
  3. Close test script
  4. Restart test environment
  5. Reconfigure test accounts
  6. Re-enter test parameters
  7. Execute test
  8. ⏱️ 5-10 minutes per iteration
  1. Make code changes
  2. Run anchor build
  3. UI updates automatically
  4. Continue testing
  5. ⏱️ 30 seconds per iteration

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

During hot reload, Testship preserves:

  • Connected wallet
  • Selected network
  • Account suggestions list
  • Transaction history (up to reload)
  • Favorite accounts
  • UI preferences

Stay informed with:

  • Toast notification on successful reload
  • Summary of changes detected
  • Warning for breaking changes
  • Error messages if reload fails

Configure what triggers reloads:

testship.config.toml
[hot_reload]
enabled = true
watch_idl = true
watch_types = true
auto_reload_ui = true
preserve_state = true

Choose reload behavior:

  • Full Reload: Complete UI refresh
  • Partial Reload: Update only changed parts
  • Manual Reload: Prompt before reloading
  • Background Reload: Update without interruption

Prevent excessive reloads:

  • Wait for build completion
  • Batch multiple file changes
  • Configurable delay after changes

For workspaces with multiple programs:

  • Track changes to all programs
  • Switch between program UIs
  • Maintain separate sessions
  • Hot reload each independently

When deploying updates:

  • Detect program address changes
  • Update IDL references
  • Maintain account mappings
  • Warn about breaking changes

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

If hot reload fails:

  • Clear error message
  • Suggestion for manual refresh
  • Automatic retry
  • Rollback to last working state

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

Customize notification behavior:

  • Toast messages
  • Desktop notifications
  • Sound alerts
  • Browser tab title updates

Iterate quickly on program design:

  1. Add new instruction
  2. Build
  3. Test immediately
  4. Refine based on results
  5. Repeat

Fast debug cycle:

  1. Identify issue in testing
  2. Fix code
  3. Build
  4. Verify fix instantly
  5. No setup needed

Smooth feature addition:

  1. Implement new feature
  2. Build
  3. Test UI appears automatically
  4. Validate with real transactions
  5. Iterate rapidly

Experiment with Solana concepts:

  1. Modify program parameters
  2. See effects immediately
  3. Understand relationships
  4. Build intuition faster

Hot reloading is optimized for speed:

  • IDL Parsing: < 100ms
  • UI Generation: < 500ms
  • State Migration: < 200ms
  • Total Reload Time: ~1 second

Minimal network usage:

  • Only IDL file monitored (KB-sized)
  • No unnecessary on-chain queries
  • Efficient file watching
  • Configurable polling interval

Check these common issues:

  1. IDL not updating

    • Ensure anchor build completes successfully
    • Check target/idl/ directory exists
    • Verify file permissions
  2. UI doesn’t refresh

    • Check if hot reload is enabled
    • Look for error notifications
    • Try manual refresh
  3. State lost after reload

    • Check preserve_state setting
    • Some breaking changes can’t preserve state
    • Session sharing maintains state

Force a reload:

  • Press Ctrl+R (or Cmd+R on Mac)
  • Click “Refresh UI” button
  • Restart Testship completely
  • Keep Testship running continuously
  • Build frequently to catch errors early
  • Review change notifications
  • Use version history for big changes
  • Share sessions with hot reload enabled
  • Document program version with each test
  • Use session snapshots before breaking changes
  • Enable desktop notifications for collaborators

Planned enhancements:

  • Hot reload for program upgrades
  • Visual diff of IDL changes
  • Automatic test re-execution
  • Change impact analysis
  • CI/CD integration

Explore the roadmap feature Export to Tests to see how Testship will integrate with your CI/CD pipeline.