Live reload for client plugins
While you work on a plugin's client code in the web development loop, DataMind Oda swaps rebuilt bundles into the open pages: the edited interface appears without a restart and without reloading the page. This page covers how Oda notices an edit, what a swap preserves, and how to recover when one fails.
How an edit reaches the page
- Run the web development loop and keep the web interface open in a browser: the loop serves it and rebuilds the browser-side bundles as you edit sources; see Building and shipping Oda.
- Oda checks each bundle for changes on a short interval: 500 ms by default (the
pollIntervalMs value; the minimum is 1 ms).
- A bundle counts as changed when its file details change: the modified time, the change time and the size. Oda does not compare or hash file contents.
- Those details catch small differences: a rewrite that keeps the modified time and the size is still noticed, because the change time moves; a bundle you delete and restore is reloaded when it comes back; an edit that lands between startup and the first check is still picked up, exactly once.
- Restarting the development session over unchanged files keeps every bundle's identity, so a page that reconnects replaces nothing.
What a swap does
- Swaps run one at a time, and the changed bundle is replaced whole, not in part.
- In each open page the previous copy of the plugin is shut down first; the new copy is then loaded, started and mounted in its place, and styles are applied only after the previous copy has finished shutting down.
- Plugins that depend on the edited one reload with it.
- The edited interface appears immediately; the page itself is never reloaded.
- A swap restarts the plugin with fresh state: its own state, React state included, is lost, while your session, workspace and connection stay as they are.
- A swap stays out of the conversation: the model sees no new input or output.
- A page ignores update messages it does not recognise, and a message it cannot parse is reported on the page itself; in both cases the page keeps running.
When a swap fails
- If the new bundle cannot be downloaded, the copy already running stays active.
- If the failure comes after the previous copy has been torn down, nothing rolls back: the plugin stays out until a retry brings it back.
- A failed swap is reported on the page itself; the rest of the page keeps working.
- Recover with a retry: Settings > Plugins > Plugin list re-delivers the latest state of the client plugin set even when it has not changed, and a later rebuild also retries the affected plugin. See Settings sections and plugins.
- When the development loop stops, deliveries stop with it: open pages keep running the code they have, and no further swaps arrive.
Questions, answered
Do I need to restart the app to see a client edit?
No. With the web development loop running, a rebuilt client bundle is swapped into every open page by itself; nothing restarts and the page is not reloaded. See Building and shipping Oda for running the loop.
How does my edit reach the open page?
The loop rebuilds the browser-side bundle as you edit. Oda checks each bundle for changes and, when one has changed, loads the new copy into every open page and starts it in place of the previous copy. Changes are swapped one at a time.
What makes Oda notice an edited bundle?
The bundle's file details: its modified time, change time and size. Oda does not compare or hash file contents, so a rewrite that keeps the modified time and the size is still noticed (the change time moves), and a bundle deleted and restored is reloaded when it comes back.
How quickly is an edit picked up?
Once the loop has rebuilt your change, the next check picks it up; checks run on a short interval, 500 ms by default. The rebuild is the first step, so the time to the swap is the rebuild plus one check at most.
Does a reload keep my plugin's state?
No. Each swap restarts the plugin with fresh state, so anything it was holding, React state included, is lost. Your session, workspace and connection stay as they are.
Why did reconnecting not replace my plugins?
Bundles are identified by their file details, not their contents. If nothing on disk has changed, there is nothing to replace: opening or reconnecting a page syncs it to the current set, and unchanged bundles are not swapped again.
Why did my client plugin stop after an edit?
A swap tears down the previous copy before the new one starts, and there is no rollback. If the download of the new bundle fails, the running copy is left as it is; if the failure comes later, after the previous copy has been torn down, the plugin stays out until a retry brings it back.
How do I recover a failed swap?
Retry from Settings > Plugins > Plugin list: the retry re-delivers the latest state of the client plugin set even when it has not changed, so a plugin that did not come back is loaded again. A later rebuild also retries the affected plugin; see Settings sections and plugins.
Does a swap touch my conversation?
No. A swap is invisible to the conversation: the model sees no new input or output.
Does live reload of client code apply in the desktop app?
No. This path keeps the web interface's open pages in sync with rebuilt bundles; the desktop app does not swap client code this way. For how changes apply while Oda runs in the app, see Hot reload.