diff --git a/src/components/EmailBodyView.tsx b/src/components/EmailBodyView.tsx index addfc435..bc2068f9 100644 --- a/src/components/EmailBodyView.tsx +++ b/src/components/EmailBodyView.tsx @@ -19,7 +19,7 @@ import { useContactsStore } from '../stores/contacts-store'; import { useLocaleStore } from '../stores/locale-store'; import { spacing, typography, type ThemePalette } from '../theme/tokens'; import { useColors, useResolvedTheme } from '../theme/colors'; -import { perfEndAfterPaint } from '../lib/perf-marks'; +import { perfEndAfterPaint, perfLap } from '../lib/perf-marks'; import type { RootStackParamList } from '../navigation/types'; type Nav = NativeStackNavigationProp; @@ -684,6 +684,9 @@ export default function EmailBodyView({ [prepared.isHtml, prepared.applyInversion, quoteLabels], ); + // Performance harness: how much of opening a message is the WebView. + React.useEffect(() => { perfLap('open-message', 'body-mounted'); }, []); + const onMessage = (e: WebViewMessageEvent) => { const data = e.nativeEvent.data; // The body reported its size: it is laid out (performance harness). @@ -791,6 +794,7 @@ export default function EmailBodyView({ injectedJavaScript={injectedJs} onMessage={onMessage} onLoadEnd={() => { + perfLap('open-message', 'webview-loaded'); // A (re)load resets the page's zoom state to 1 — drop any host-side // scroll locks so they can't go stale (e.g. cid images arriving // reload the source mid-zoom). diff --git a/src/lib/perf-marks.ts b/src/lib/perf-marks.ts index 3bcbeadd..6fb3cdc4 100644 --- a/src/lib/perf-marks.ts +++ b/src/lib/perf-marks.ts @@ -46,6 +46,14 @@ export function perfEnd(name: string, detail?: Record