Resolve cid: inline images at sanitize time to stop signature flicker

Fixkamo-internal
Shipped
May 15, 2026 at 11:53 PM UTC
Author
kamo
Commit
ecbf290

Cid: rewriting was happening in a post-commit useEffect, so the sanitized HTML hit the DOM with literal src="cid:..." and the effect mutated each img on the next tick. Any re-render that reset innerHTML (e.g. cache vs fresh body fetch, mark-as-read, websocket-triggered loadMessages) wiped the rewrite and forced another cid: → URL roundtrip, which surfaced as rapid flicker on signature logos. Move the cid: rewrite into the DOMPurify pipeline (uponSanitizeAttribute resolves known cids to the inline endpoint, afterSanitizeAttributes drops imgs whose cid couldn't be resolved) and key the renderer's sanitize memo off the stable inlineCidKey string. The imgs that hit the DOM now carry the correct src from the first paint and survive any innerHTML reset.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing