perf(client): defer chat persistence dependencies

This commit is contained in:
2026-07-15 17:58:06 +08:00
parent 86ffbbcdbc
commit 05ca15be48
15 changed files with 115 additions and 81 deletions
+15 -13
View File
@@ -30,17 +30,17 @@ Compressed sizes below are Turbopack module estimates. `Eager` is the route's sy
| Route | Direct-import baseline | Current eager baseline | Change | Current async baseline |
| --- | ---: | ---: | ---: | ---: |
| `/splash` | 646.2 KiB | 649.5 KiB | +3.3 KiB | 14.3 KiB |
| `/chat` | 669.8 KiB | 672.8 KiB | +3.0 KiB | 14.7 KiB |
| `/subscription` | 658.4 KiB | 662.0 KiB | +3.6 KiB | 20.6 KiB |
| `/tip` | 651.6 KiB | 656.0 KiB | +4.4 KiB | 20.6 KiB |
| `/splash` | 646.2 KiB | 599.7 KiB | -46.5 KiB | 49.2 KiB |
| `/chat` | 669.8 KiB | 637.8 KiB | -32.0 KiB | 49.6 KiB |
| `/subscription` | 658.4 KiB | 616.9 KiB | -41.5 KiB | 20.6 KiB |
| `/tip` | 651.6 KiB | 610.9 KiB | -40.7 KiB | 20.6 KiB |
The earlier direct-import pass replaced root `@/utils` and `@/data/storage`
barrel imports with symbol-level module paths. The current column captures the
full application after the subsequent feature work and is the baseline enforced
by the budgets below. Dexie and UA Parser remain in the analyzed routes through
active feature dependencies and require separate feature-boundary work to
remove from the eager graph.
barrel imports with symbol-level module paths. The current Client-boundary pass
separates the Payment → User and Payment → Chat synchronizers, uses direct
provider imports, and loads the Dexie-backed chat repository through a dynamic
import. UA Parser remains an intentional eager dependency because the app still
requires its general browser, OS, and device detection behavior.
Module loading baseline:
@@ -51,6 +51,8 @@ Module loading baseline:
| Stripe payment dialog | eager | async |
| Chat reply animation | eager | async |
| `lottie-react` | dependency present, not bundled | removed |
| `ua-parser-js` | eager | eager (retained intentionally) |
| Dexie | eager on all baseline routes | async on `/splash` and `/chat`; absent on `/subscription` and `/tip` |
The total potential graph can grow slightly because an async chunk has its own loader metadata. The primary budget is the eager graph and the audited module phase, not the sum of eager and unopened async code.
@@ -58,10 +60,10 @@ The initial budgets are intentionally above the baseline and are enforced by CI:
| Route | Eager client JS budget |
| --- | ---: |
| `/splash` | 650 KiB |
| `/chat` | 675 KiB |
| `/subscription` | 665 KiB |
| `/tip` | 660 KiB |
| `/splash` | 605 KiB |
| `/chat` | 645 KiB |
| `/subscription` | 625 KiB |
| `/tip` | 620 KiB |
## Lab Web Vitals baseline