perf(mask): cut popup startup latency - #12469
Merged
Merged
Conversation
Lazy-load route frames, routed modals, and React Query devtools; split the Wallet/Friends/Trader route tables into lightweight modules; stop loading React DevTools into the popup entry; parallelize popup init imports and stop blocking startup on telemetry; defer Flow/Solana wallet state init on popup pages until after the EVM state is ready. Deferral safety: keep initializing all states up front when the persisted site provider is non-EVM or the connect-wallet modal is requested (decode the percent-encoded modal param first), settle the modal readiness gate instead of rethrowing during render, keep the SingletonModal hosts mounted with the first commit, and contain modal crashes in an error boundary. Derive trader sub-route paths from RoutePaths and import NormalHeader directly in PersonaHeader so the main chunk stays light.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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
Popup cold-start optimization for the browser-action popup:
lazy, with their route tables moved into lightweightroutes.tsxmodules so the main chunk no longer pulls the heavy page graphs; routed modals and React Query devtools are lazy as well.popups/initialization/index.tsand stop blocking startup on the telemetry ID round-trip.initWallet({ deferNonEVM })returns separateinitialStateReady/allStatesReadyhandles; render gates on the former when deferral is active).Deferral safety (from code review)
getActivatedPluginWeb3State→state!).from=%2Fselect-provider,modal=…) instead of matching rawlocation.hash, so the fast path actually fires for the wallet-connect onboarding popup.use()inmodals.tsx) suspends on a settling variant ofallStatesReady— an init failure no longer rethrows during render and nukes the whole popup; modal crashes are contained by anErrorBoundary.Modals(SingletonModal hosts) stays statically imported:openAndWaitForClosecallers hang forever if a host registers late.RoutePaths(const enum, zero runtime cost) instead of duplicated literals;PersonaHeaderimportsNormalHeaderdirectly instead of the components barrel soWalletBalance/TokenPickerstay out of the main chunk.Test plan
tsc -b packages/mask/popups(full reference graph) passes