Resolve the org's icons on the server and preconnect the origin

Performancekamo-marketing
Shipped
August 20, 2026 at 2:28 AM UTC
Author
Kamo
Commit
dfcbf3d

Lighthouse named theme.kamocrm.com as an unconnected origin worth 300 ms while also reporting no origins preconnected, and last round I read that as a stale complaint about the stylesheet I had just inlined. It was not. That origin is still contacted on every load — DynamicMetaLoader fetched config.json from it and then appended five favicon links pointing back at it — and all six requests fired from an effect at hydration, inside the window the same report charges 1,660 ms of "element render delay" to. So the connection was real and unhinted, and the work behind it was avoidable: · config.json is read on the server now (getThemeMeta, cached and bounded by the same timeout as the other two theme reads), so the canonical host makes no cross-origin fetch from script at all. · The icons are rendered into <head>, where the preload scanner finds them while parsing instead of the main thread creating them when it is busiest. They are the theme bucket's icons, not the local ones — those genuinely differ, so serving the local copies instead would have changed what people see in a tab. · The preconnect is back, and deliberately WITHOUT crossorigin. That attribute decides which connection pool the socket lands in, and a hint in the wrong mode is exactly why an earlier attempt measured as unused: what this origin serves the browser is now the icon set, and icon requests are credentialed and non-CORS. A white-label host still takes the full runtime path, which is the only reason any of this code exists. What it no longer does is run for the canonical site, where every value it was fetching is known at render time. Incidentally fixes a bug that was never about performance: the effect set document.title to the org name, so every page's title was overwritten with "KamoCRM Inc." a moment after the correct per-route one had rendered.

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