You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored and
Braedon Saunders
committed
Stop preloading cost-intelligence rows on workspace load + add gzip
The workspace page was eagerly fetching up to 5000 EffectiveCost rows
(each with a full resource + sourceObservation join) on every load,
because the always-mounted AssemblyInsertModal called
useAssemblyAuthoringContext() unconditionally. That single request took
~22s and dominated an ~8MB, 40s page load — even though the assembly
picker was never opened and the cost dropdown already does indexed
dynamic search.
Three fixes:
1. Gate useAssemblyAuthoringContext on an `enabled` flag; the modal
passes `open`, so the heavy picker data (catalogs, rates, labor
units, effective costs) only loads when the picker is actually opened.
2. Add @fastify/compress (global gzip/brotli, 1KB threshold) so large
JSON payloads no longer ship uncompressed. SSE routes use
reply.hijack() and are unaffected; already-compressed file types are
skipped by the mime filter.
3. Add an includeObservation flag to listEffectiveCosts; the assembly
path passes false to skip the large sourceObservation (rawText) join
it never uses.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments