Repository navigation
perf(web): reduce Cloudflare request bursts, cache assets, and respect rate limits - #21
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/build-web.ts): bundle each of the 8 online web entrypoints separately withsplitting: trueso dynamic imports (English dictionary,runViews) remain lazy without splitting shared modules into 20+ extra HTTP requests per cold page load (first visit drops from 34 to 17 static requests;research.jsdrops from 20 chunks to 1 shared chunk).apps/web/staticFiles.ts): serve immutableassets/katex/*withpublic, max-age=31536000, immutable, no-transformandassets/*(fonts,mark.svg, licenses) withpublic, max-age=86400, stale-while-revalidate=604800, no-transform, eliminating 7 repeat-visit origin/edge revalidations per page load.retry: 5000to/api/runs/stream(apps/web/server.ts), widen fallback polling intervals when SSE is disconnected (apps/web/client/app.ts), pause background polling whendocument.hiddenis true and honorRetry-After/ Cloudflare 1015 /cf-mitigated: challengecooldowns inapps/web/client/researchShared.tsx, and reduce idle polling inresearchViews.tsx,researchOverview.tsx, andcollaborationMessageSummary.tsx.Verification
bun run typecheck,bun run typecheck:web,bun run typecheck:sitewebResearchSession,webStaticFiles,webRunStream,webServer,webClient,webI18n,webFonts— 114 tests; plustest:frontend-research-unit)test:web-load,test:web-live-sync,test:web-rate-limit,test:web-research-workspace,test:web-ui,test:web-login,test:web-share,test:web-natural-first,test:web-performance, etc.)