Skip to main content

Hot reload

Save a file; every attached target — simulator and devices — reloads in well under two seconds, usually much less. This page explains exactly what happens so the behavior never surprises you.

What a reload does

  1. kog dev recompiles incrementally (typically < 300 ms) and broadcasts the new bundle over WebSocket (Wi-Fi) or serial.
  2. The target tears down the current app: effects are disposed, JS-held hardware claims (pins, buses, PWM channels) are released, and the current screen's widgets are deleted.
  3. The new bundle is evaluated from RAM (the installed app in flash is untouched) and the app remounts.
  4. Navigation state is preserved — you land back on the screen you were editing, with the same route params.

What is and isn't preserved

Preserved across reload
Current route + params
useStorage values (device KV storage)✅ (they're persistent by nature)
useState / in-memory state❌ — remounts fresh in v1
Hardware claims❌ — released and re-claimed by the new code (this is what you want)

State-preserving Fast Refresh (keeping useState values across reloads) is designed into the runtime's architecture and planned post-v1.

Errors during development

  • Compile errors never reach the device: they render as an overlay in the simulator and in your terminal, with the file/line and a web-developer-readable message.
  • Runtime errors show a compact error screen on the target and a full source-mapped stack in the terminal.
  • console.log/warn/error from every target streams to the kog dev terminal, labeled and source-mapped. Console calls are stripped from --release builds.