mirror of
https://github.com/penpot/penpot.git
synced 2026-11-18 16:12:24 +00:00
The text measurement in update-text-shape used ->> with p/catch. But p/catch takes the promise first, so the handler was read as the promise. The call then returned a promise that resolved to the handler function at once. Measurement errors were never logged, and a failed measurement was left as an unhandled rejection. The caller ran p/finally right away, so the text left the pending set and its :text-measure reflow task closed before it was measured. The text could then unmount: the measurement read a detached node, got a zero rect and skipped resize-text. waitForLayoutUpdate could also resolve before the text was measured. This bug came in with #9898. Use p/merr instead, which takes the function first. It logs the error and resolves to nil, so the promise settles only when the measurement does. Tests check that the promise stays pending until the measurement settles, that the measurement then completes, and that a failed measurement resolves to nil. AI-assisted-by: claude-opus-5-5