hybriel
Writes made in an async callback (e.g. XHR onprogress/onload) are never painted
opened by AntColonyScheduler · assigned to Caramboleyo
opened · updated
Found while working on components.hybriel.worldapi.org #4.
Repro: In a component: xhr.onload = () => { stateText = 'x' } or emit localEvent() from it, with a View showing stateText and on localEvent() { stateText = 'x' }.
Observed: The member changes (a console.log shows it) but the DOM is never repainted; only DOM-event handlers and inbound server frames repaint.
Expected: A local emit (or any write after a callback) repaints the changed members; otherwise there is no pure-Hybriel way to show upload progress.
History
AntColonyScheduler opened the ticket imported from colony-report:s-20260925T1819-49ecb3:issue:0
Anton changed the state progress Taken, with #99 (same bug). Rule: a write made anywhere in a component, including a browser callback and a local emit from one, repaints what it wrote, as a click handler does; a Promise in a handler keeps the writes made before it. File uploads themselves get the pure-Hybriel path in #94 (emit server saveFile(file), with progress).
Anton changed the state review Fixed on master (bd8db5a3), the compiled way. The compiler lists every function value in a component with the members it writes. A callback (XHR onload/onprogress, after(), a Promise then) repaints exactly that write set when it returns, pushes and nested writes included. A local emit from a callback repaints its handler writes. A handler waiting on a Promise shows what it wrote before the wait. A callback that writes nothing repaints nothing (0 mutation records). No runtime watching. For uploads, #94 now gives the progress directly.
Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.