Edit preference and the whitelabel cover page stop loading SharedModule

/edit-preference fetched 6.03 MB of lazy JavaScript on a first visit. It now fetches 4.33 MB. The whitelabel cover page editor drops from 5.29 MB to 3.18 MB. EditPreferenceModule and WhitelabelCoverPageModule are gone. Dashboard is the last of the 45 lazy entry points that still loads SharedModule.

branch t3code/shared-module-edit-preference on top of 9897f212fd, step 6 Step 7 of the plan 2 commits, PR 10839

Lazy JavaScript per route

What a first visit fetches on top of the initial bundle, from the QA build. Before means after step 6. MB means a million bytes.

RouteBeforeAfter
/edit-preference and its pages6.03 MB4.33 MB
/edit-preference/whitelabel-cover-page and its pages5.29 MB3.18 MB
/dashboard, still on SharedModule5.66 MB5.65 MB

The initial bundle is 4 bytes smaller, and no other entry moved by more than 1 KB. The build has 272 JavaScript files where step 6 had 271.

Commit 56a5ec11eb: make edit preference standalone

52 files, +646 −315

What changed

  • edit-preference.module.ts and edit-preference-routing.module.ts are deleted. /edit-preference loads EDIT_PREFERENCE_ROUTES from the new edit-preference.routes.ts. The routes, guards and data are the same.
  • The 48 components the module declared are standalone. Earlier steps had already converted everything they render, so no SharedModule piece had to change.
  • The module provided three services. NgxImageCompressService is already provided in root, and the root injector already provides TitleCasePipe. DatePipe was only used by the delegate details page and the transaction detail modal it renders, so DelegateDetailsComponent provides it now.
  • The module's CUSTOM_ELEMENTS_SCHEMA hid a [socialHandles] binding on the social links modal in the link in bio editor. The modal has no such input and loads the handles itself, so I removed the binding.
  • Three components lose the phone directive. Their templates have no phone input.
  • The whitelabel cover page under /edit-preference still loaded its own module in this commit.

How I checked it

CheckResult
Compiled template dependencies against step 6647 of 650 components match. The other three lose only the phone directive.
QA and development buildsBoth pass. QA has the same 42 warnings as base. Development has none.
Server rendering, 138 URLsAll match step 6. The list now has 41 edit preference paths, including guarded, redirected and unknown ones.
Logged-in browser run, white-label site34 edit preference and cover page URLs. Same components and no page errors. Pages that were still loading after 6 seconds were run again with a longer wait, and then matched.
InteractionsThe social links modal opens with the same three saved handles. On the white-label appearance form, opening a second color picker closes the first, on both builds.
Every component on the entry resolves in the browser286 components on edit preference, and 273 on the cover page it loads. No problems and no page errors.
ESLint on the changed files4 errors, down from 52. The 48 gone are prefer-standalone. The four left exist on base.

The test account has no delegates, so the delegate details page, the one that needs DatePipe, wasn't opened in a browser.

Commit e92a285200: make the whitelabel cover page standalone

31 files, +227 −131

What changed

  • whitelabel-cover-page.module.ts and its routing module are deleted. The cover page loads WHITELABEL_COVER_PAGE_ROUTES from the new whitelabel-cover-page.routes.ts, with the same four routes.
  • The 25 components the module declared are standalone.
  • They needed two SharedModule pieces, VipOfferShareModalComponent and ScrollContainerLoaderDirective. Both are standalone now. They moved from SharedModule's declarations to its imports, so SharedModule still exports them. It has 45 declarations left.
  • The add section page renders 53 of MarketingPageSharedModule's 57 pieces, so it imports the module, as the marketing pages do.
  • Three components lose the phone directive. Their templates have no phone input.

How I checked it

CheckResult
Compiled template dependencies against the edit preference commit647 of 650 components match. The other three lose only the phone directive.
QA and development buildsBoth pass with the same warnings as before.
Server rendering, 138 URLsAll match the edit preference commit.
Every layout in the add section modalAll 47 open the section editor with the same components on both builds, and no page errors. Scrolling the featured creator picker behaves the same.
Other cover page actionsEditing the header and the footer, the preview and the add sub-page button land on the same pages. The VIP deals picker opens with the same content. The test account has no VIP deals, so it shows the empty state.
Every component on 3 entries resolves in the browserThe cover page, edit preference and dashboard. No problems and no page errors.
ESLint on the changed filesNo errors, down from 27. All were prefer-standalone.

Verification checklist

Use a creator account on its white-label site. Keep the console open. Checks that end in save change real data, so use a test account. Checks are saved in this browser.

0 of 0 checked

High Cover page editor

High Edit preference

Medium Other edit preference tabs

Low Routing