fix(desktop): keep Detach canvas wasm-owned so PiP close cannot freeze app #86
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/VAPP-70-detach-pip-canvas-freeze"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The Desktop tab's Detach control moves the live KVM into a Document Picture-in-Picture window. The canvas was a Dioxus-rendered element, so moving it out of the renderer's document left Dioxus's DOM registry pointing at a node in another document; on re-dock (or any re-render while detached) the wasm render/event loop threw and stopped dispatching events app-wide, matching the reported symptom that every tab and left-hand menu item went dead until a full page reload (Defect B).
The fix makes the live canvas wasm-owned instead of Dioxus-owned. DesktopPane now renders an empty mount div (display: contents so layout is identical) and the wasm driver creates the canvas via create_element("canvas") and inserts it into that mount. Detach moving a node Dioxus never knew about is invisible to the renderer, so its diffing and synthetic-event dispatch stay intact through detach, re-dock, and window-close. The view-mode display CSS, previously a reactive rsx attribute, is now pushed imperatively via DesktopHandle::set_view_css on mode change and on attach.
For the blank-viewport report (Defect A), after the canvas moves into the PiP window the driver asks the agent to re-ship every tile (send_refresh) so a live frame paints immediately rather than staying blank until the next changed tile; the canvas node and its 2D context are preserved across the cross-document move, so the re-blit lands on the same surface.
The /relays address bar and dead Enter/refresh/no-network behavior are the browser's display artifacts of a non-navigable Document PiP companion window, not a navigation; no code navigates it (the detach path contains no /relays reference).
Adds src/components/desktop_pip_guard.rs, a compile-time guard test that fails if the KVM canvas ever becomes a Dioxus rsx element again or if the wasm-side creation disappears, so the invariant is enforced mechanically.
#VAPP-70
The Desktop tab's Detach control moves the live KVM <canvas> into a Document Picture-in-Picture window. The canvas was a Dioxus-rendered element, so moving it out of the renderer's document left Dioxus's DOM registry pointing at a node in another document; on re-dock (or any re-render while detached) the wasm render/event loop threw and stopped dispatching events app-wide, matching the reported symptom that every tab and left-hand menu item went dead until a full page reload (Defect B). The fix makes the live canvas wasm-owned instead of Dioxus-owned. DesktopPane now renders an empty mount div (display: contents so layout is identical) and the wasm driver creates the canvas via create_element("canvas") and inserts it into that mount. Detach moving a node Dioxus never knew about is invisible to the renderer, so its diffing and synthetic-event dispatch stay intact through detach, re-dock, and window-close. The view-mode display CSS, previously a reactive rsx attribute, is now pushed imperatively via DesktopHandle::set_view_css on mode change and on attach. For the blank-viewport report (Defect A), after the canvas moves into the PiP window the driver asks the agent to re-ship every tile (send_refresh) so a live frame paints immediately rather than staying blank until the next changed tile; the canvas node and its 2D context are preserved across the cross-document move, so the re-blit lands on the same surface. The /relays address bar and dead Enter/refresh/no-network behavior are the browser's display artifacts of a non-navigable Document PiP companion window, not a navigation; no code navigates it (the detach path contains no /relays reference). Adds src/components/desktop_pip_guard.rs, a compile-time guard test that fails if the KVM canvas ever becomes a Dioxus rsx element again or if the wasm-side creation disappears, so the invariant is enforced mechanically. #VAPP-70