Web presenter: a delta lost to a full popup inbox brings the images again

Each snapshot delta carries its send number. A popup that sees a gap asks the
audience to resync, and the next delta carries every image, so the popup
cannot keep one slide's picture beside another's notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Dylan M. Taylor
2026-11-30 16:54:14 +00:00
co-authored by Claude Opus 5.5
parent 81bd17934c
commit c53cefd4d6
4 changed files with 52 additions and 11 deletions
+9 -1
View File
@@ -10,7 +10,7 @@ use craft::ui::runtime::frame::FrameInput;
use craft::ui::shell::{AppShell, embed};
use craft::web_host::link::{LinkLimits, LinkState, WindowLink};
use craft::web_host::popup::{PopupOpener, PopupPeer};
use deckcraft_ui_egui::presenter::{Preview, Snapshot, SnapshotDelta, merge};
use deckcraft_ui_egui::presenter::{Command, Preview, Snapshot, SnapshotDelta, merge};
// PLAN: assumed pub const SHOW_SCOPE: craft::ui::runtime::commands::CommandScope in presenter_view (show-w7)
use deckcraft_ui_egui::presenter_view::{NextPic, PresenterModel, PreviewPic, SHOW_SCOPE, presenter_body};
use deckcraft_ui_egui::show::{Blank, GridSource};
@@ -46,6 +46,8 @@ enum Picture {
pub struct PopupApp {
peer: PopupPeer,
snapshot: Option<Snapshot>,
/// The number of the last delta received.
seq: Option<u64>,
textures: TextureStore<Picture>,
current_revision: u64,
next_revision: u64,
@@ -65,6 +67,7 @@ impl PopupApp {
Ok(Self {
peer,
snapshot: None,
seq: None,
textures: TextureStore::in_context(ctx, "deckcraft.popup", TextureStoreOptions::frames()),
current_revision: 0,
next_revision: 0,
@@ -76,6 +79,11 @@ impl PopupApp {
// take drains only this pass's arrivals; a second pass sees no replay of earlier deltas.
for payload in self.peer.take() {
let Some(delta) = SnapshotDelta::from_payload(&payload) else { continue };
if self.seq.is_some_and(|seq| delta.seq != seq.wrapping_add(1)) {
// A full inbox dropped a delta, which may have carried an image: ask for every image again.
let _ = self.peer.post(&Command::Resync.to_payload());
}
self.seq = Some(delta.seq);
if delta.current_changed {
self.current_revision = self.current_revision.wrapping_add(1);
self.textures.forget(ctx, &Picture::Current);