KamoCRM

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

Fixkamo-internal
Shipped
15 மே, 2026 அன்று 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?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing