Repository navigation
Description
Summary
The release-readiness review (.claude/reports/RELEASE_READINESS.md §1.1, Appendix A — local, gitignored) measured the eager payload at 477 KiB gzipped for the standalone page (entry + every modulepreload in dist/index.html) and ~490 KiB for the embed graph — roughly 3–5× a reasonable budget for a third-party embed. A further ~400 KiB gz mapbox-gl chunk is discovered only after the App chunk parses, so the real payload before first meaningful paint is ≈877 KiB gz as a serial waterfall. The main drivers are three secondary drawer views that most visitors never open, all statically imported by DrawerStack — the calendar (the entire Schedule-X stack: ~720 sx__ selectors land in the eager App chunk), registration (react-hook-form), and share (react-share). This ticket adds lazy seams for those three views, gives the embed entry the preload hints it currently lacks entirely, and cleans up two build-output warts found alongside.
Current behavior
src/views/DrawerStack/DrawerStack.tsx:34,39,40statically importCalendarView,RegistrationView, andShareView(report snapshot cited lines 27,32,33; verified at these lines onfeat/classify-errors). All three ride in the eager graph.- Only 3 lazy seams exist today:
EventDetails(viaEventView), the Lightbox, and the adminPreviewController. EventViewalready carries the right retry pattern for a lazy seam:loadEventDetails(src/views/EventView/EventView.tsx:25-41) mints a freshlazy()per attempt, because React caches a lazy component's rejected payload forever — a module-scopelazywould make the boundary's "Try again" a visibly-does-nothing button (issue feat(widget): classify errors and show only the actions that can help #89). Replicate this, don't reinvent it.- Swiper is bundled twice (both the
AppandEventRegistereager chunks) even though its only consumer sits behind the lazyEventDetailschunk (report §1.1 / Appendix A). dist/embed.jsemits zeromodulepreloadhints (grep-confirmed against a production build) — host embeds get a strictly deeper discovery waterfall than the standalone page, which at least gets<link rel="modulepreload">tags indist/index.html..DS_Storefiles are deployed indist/(report §1.1 housekeeping).
Proposed changes
React.lazythe three drawer views (CalendarView,RegistrationView,ShareView) fromDrawerStack, each behind a Suspense fallback consistent with the existing drawer loading chrome (DrawerLoading/ the existing boundary + suspense structure inDrawerStack), and using the minted-per-attempt lazy retry pattern fromEventView.tsx:25-41so a failed chunk load stays recoverable.- Respect the boundary/seam rules in
.claude/rules/i18n-and-state.md(error-boundaries section): the drawer chrome must render immediately while the body chunk loads — never split a view to manufacture a seam; the fallbacks render their own chrome. - After the seams land, verify the Swiper duplication disappears from the eager graph (it should follow
EventDetails's chunk); if it doesn't, chase and document the cause. - Emit
modulepreloadhints for the embed entry's eager graph — either a Vite plugin that injectslinkpreloads fromembed.jsat runtime, or a documented host snippet; implementer evaluates and records the decision. - Exclude
.DS_Storefrom build output.
Acceptance criteria
-
CalendarView,RegistrationView, andShareViewload via lazy seams;@schedule-x/*,react-hook-form, andreact-shareno longer appear in the eager graph (e.g. nosx__selectors in the eager App chunk). - Before/after eager-payload numbers in the implementation report, measured the honest way (per project memory: never claim a bundle saving from one chunk's size — rolldown re-chunks): entry + every modulepreload in
dist/index.html, gzipped, both before and after — and the equivalent full eager graph forembed.js. Expected ballpark: 150–250 KiB gz reduction. - No drawer flashes unstyled or blank on first open: the drawer chrome (header, close control) renders immediately while the body chunk loads, per the seam rules in
.claude/rules/i18n-and-state.md. - A failed chunk load is retryable: the boundary reset mints a fresh
lazyper theEventView.tsx:25-41pattern (no permanently-cached rejection). - Swiper appears in at most one chunk, reachable only behind the lazy
EventDetailsgraph — or the cause of the duplication is chased and documented. -
dist/embed.jsconsumers get preload coverage for its eager graph (plugin), or the documented host-snippet alternative is written up with the decision rationale. - No
.DS_Storefiles indist/after a clean build. -
pnpm lint && pnpm typecheck && pnpm test:run && pnpm buildpass. - Write an implementation report to
.claude/reports/<issue-number>-lazy-drawers.md— in the MAIN checkout at/Users/devindra/Documents/Projects/SahajAtlasWebeven when implementing from a worktree (the folder is gitignored) — covering what changed, what was deliberately NOT changed, and which readiness-report findings are resolved.
Files affected
src/views/DrawerStack/DrawerStack.tsx— imports/lazy seams onlyvite.config.ts— plugins section onlysrc/views/CalendarView/CalendarView.tsx,src/views/RegistrationView/RegistrationView.tsx,src/views/ShareView/ShareView.tsx— export shape only, if the lazy wrapper needs it
Parallel implementation: this ticket OWNS the files above; sibling release-hardening tickets run concurrently. In shared files the ownership is regional: a sibling a11y ticket owns the PeekStrip component region of DrawerStack.tsx (this ticket touches only the import/lazy-seam region), and a sibling ticket owns the build-output section of vite.config.ts (this ticket touches only the plugins section). Avoid edits outside owned files/regions except strictly additive ones.
References
.claude/reports/RELEASE_READINESS.md§1.1, §1.6 (recommendations 1–2, 6), Appendix A (local, gitignored)- Retry-on-failed-chunk pattern:
src/views/EventView/EventView.tsx:25-41(issue feat(widget): classify errors and show only the actions that can help #89) - Boundary/seam rules:
.claude/rules/i18n-and-state.md(error-boundaries section) - Bundle-measurement rule (project memory): measure the eager payload — entry + every modulepreload in
dist/index.html, gzipped — both ways;React.lazyon a component that renders at mount defers nothing
Metadata
Metadata
Assignees
Labels
Type
Fields
Hold Until
Activity
docs(widget): say that code-splitting makes script-src load-bearing
refactor(turnstile): one liveness rule, one page check, one crawl
fix(turnstile): partner hosts fail the captcha with 110200 (unknown d…