frame: the notes switch writes are said in this frame, as before the route moved

The route now runs before the switch, so the diagnostics it returns are held and joined to the notes after the
switch has pushed its own (a held resume dropped on leaving a surface is said in the same frame).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-29 05:42:23 +01:00
commit 7e03be6efd

View file

@ -124,17 +124,18 @@ impl Core {
pub fn frame(&mut self, input: FrameInput, ports: Ports<'_>) -> FrameOutput { pub fn frame(&mut self, input: FrameInput, ports: Ports<'_>) -> FrameOutput {
let FrameInput { now, viewport, scale, events } = input; let FrameInput { now, viewport, scale, events } = input;
let port = ports.state; let port = ports.state;
let mut diagnostics = std::mem::take(&mut self.notes);
// Input is judged entirely against the frame the user saw: its geometry and the values bound // Input is judged entirely against the frame the user saw: its geometry and the values bound
// into it. Nothing of this frame (the surface it switches to, the provider updates it drains, // into it. Nothing of this frame (the surface it switches to, the provider updates it drains,
// the tree it binds) is in place yet, so no event reads a world the user did not look at. // the tree it binds) is in place yet, so no event reads a world the user did not look at.
diagnostics.extend(self.route(&events, scale, now, ports.ids, port)); let routed = self.route(&events, scale, now, ports.ids, port);
let mut changes = Vec::new(); let mut changes = Vec::new();
if self.wanted != self.shown { if self.wanted != self.shown {
self.switch(port, &mut changes); self.switch(port, &mut changes);
} }
changes.extend(port.drain()); changes.extend(port.drain());
let mut diagnostics = std::mem::take(&mut self.notes);
diagnostics.extend(routed);
let mut effects = Vec::new(); let mut effects = Vec::new();
let mut rebound = false; let mut rebound = false;
for change in &changes { for change in &changes {