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
perf(dashnote): defer SDK value imports in note + contract helpers (#77)
* perf(dashnote): defer SDK value imports in note + contract helpers
NotesWorkspace, SessionContext, and LoginModal statically imported
contract.ts, createNote.ts, and updateNote.ts, each of which pulled
Document/DataContract/Identifier from @dashevo/evo-sdk. That anchored
the 8 MB SDK chunk to the entry graph via a hoisted static import, so
the browser fetched it before first paint despite the modulePreload
filter in vite.config.ts. Move the value imports behind a lazy module
cache (matching the loginWithPrivateKey pattern in 2b2c5a0) so the
chunk loads only when an authenticated write actually needs it.
Throttled Lighthouse (Slow 4G + 4× CPU, simulated mobile):
LCP 30.8 s → 2.0 s, FCP 16.1 s → 1.7 s, perf score 0.55 → 0.98.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor(dashnote): extract shared SDK lazy-loader to src/dash/sdkModule
Pull the duplicated `loadSdkModule` helper (type alias + cached promise +
loader function with retry-on-failure) out of contract.ts, createNote.ts,
and updateNote.ts into a single src/dash/sdkModule.ts, and have each
consumer import it. No behavior change — ESM module-graph caching makes
the previous three private promises functionally equivalent to one shared
promise. Tutorial files now show only their Dash SDK recipe without the
bundler-deferral plumbing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments