authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-10-07 22:48:55-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-07 22:48:55-07:00
log6651aaab38c6814ed7bba3e805a1ec7a01870b55
treea3db5e5ddc3595d7976aade0e885318b990dc552
parent8a1fc4149ae7b41e7d3d93f1b51dd9aeb38c4282
signature Signed by PGP key B5690EEEBB952194

perf(mobile): skip showcase subscriptions in normal builds (#16131)


1 files changed, 14 insertions(+), 11 deletions(-)

apps/mobile/src/features/showcase/ShowcaseCaptureCoordinator.tsx+14-11
...@@ -56,7 +56,14 @@ function sceneFromPathname(pathname: string): ShowcaseScene | null {...@@ -56,7 +56,14 @@ function sceneFromPathname(pathname: string): ShowcaseScene | null {
56 return null;56 return null;
57}57}
5858
59// Showcase capture only runs in showcase builds. Gate the mount so normal builds
60// never subscribe to workspace, project, or thread shell state.
59export function ShowcaseCaptureCoordinator(props: { readonly pathname: string }) {61export function ShowcaseCaptureCoordinator(props: { readonly pathname: string }) {
62 if (!SHOWCASE_ENABLED) return null;
63 return <EnabledShowcaseCaptureCoordinator pathname={props.pathname} />;
64}
65
66function EnabledShowcaseCaptureCoordinator(props: { readonly pathname: string }) {
60 const navigation = useNavigation();67 const navigation = useNavigation();
61 const { connectPairingUrl } = useConnectionController();68 const { connectPairingUrl } = useConnectionController();
62 const {69 const {
...@@ -92,7 +99,7 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })...@@ -92,7 +99,7 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })
92 );99 );
93100
94 useEffect(() => {101 useEffect(() => {
95 if (!SHOWCASE_ENABLED || pairingUrls.length > 0) return;102 if (pairingUrls.length > 0) return;
96103
97 const readLaunchRequest = () => {104 const readLaunchRequest = () => {
98 const values = getNativeShowcasePairingUrls();105 const values = getNativeShowcasePairingUrls();
...@@ -110,7 +117,7 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })...@@ -110,7 +117,7 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })
110 }, [pairingUrls.length]);117 }, [pairingUrls.length]);
111118
112 useEffect(() => {119 useEffect(() => {
113 if (!SHOWCASE_ENABLED || orientationSettled) return;120 if (orientationSettled) return;
114 const orientation = getNativeShowcaseOrientation();121 const orientation = getNativeShowcaseOrientation();
115 if (orientation === null) {122 if (orientation === null) {
116 setOrientationSettled(true);123 setOrientationSettled(true);
...@@ -130,8 +137,6 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })...@@ -130,8 +137,6 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })
130 }, [orientationSettled]);137 }, [orientationSettled]);
131138
132 useEffect(() => {139 useEffect(() => {
133 if (!SHOWCASE_ENABLED) return;
134
135 const readRequestedScene = () => {140 const readRequestedScene = () => {
136 const value = getNativeShowcaseScene();141 const value = getNativeShowcaseScene();
137 if (!value || requestedSceneRef.current === value) return;142 if (!value || requestedSceneRef.current === value) return;
...@@ -156,7 +161,6 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })...@@ -156,7 +161,6 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })
156161
157 useEffect(() => {162 useEffect(() => {
158 if (163 if (
159 !SHOWCASE_ENABLED ||
160 requestedTheme === null ||164 requestedTheme === null ||
161 themeApplied ||165 themeApplied ||
162 // Writing before stored preferences load would be overwritten by them.166 // Writing before stored preferences load would be overwritten by them.
...@@ -168,7 +172,7 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })...@@ -168,7 +172,7 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })
168 }, [appearancePreferencesReady, requestedTheme, setThemeIdForBothAppearances, themeApplied]);172 }, [appearancePreferencesReady, requestedTheme, setThemeIdForBothAppearances, themeApplied]);
169173
170 useEffect(() => {174 useEffect(() => {
171 if (!SHOWCASE_ENABLED || pairingUrls.length === 0) return;175 if (pairingUrls.length === 0) return;
172 let cancelled = false;176 let cancelled = false;
173 void (async () => {177 void (async () => {
174 await Promise.all(178 await Promise.all(
...@@ -201,7 +205,7 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })...@@ -201,7 +205,7 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })
201 const showcaseThread = threads.find((thread) => String(thread.id) === SHOWCASE_THREAD_ID);205 const showcaseThread = threads.find((thread) => String(thread.id) === SHOWCASE_THREAD_ID);
202206
203 useEffect(() => {207 useEffect(() => {
204 if (!SHOWCASE_ENABLED || !hasServerFixture || pendingTasksReady) return;208 if (!hasServerFixture || pendingTasksReady) return;
205209
206 const pendingTasks = buildShowcasePendingTasks(projects, Date.now());210 const pendingTasks = buildShowcasePendingTasks(projects, Date.now());
207 if (pendingTasks.length !== SHOWCASE_PENDING_TASK_DEFINITIONS.length) return;211 if (pendingTasks.length !== SHOWCASE_PENDING_TASK_DEFINITIONS.length) return;
...@@ -232,7 +236,7 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })...@@ -232,7 +236,7 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })
232 }, [hasServerFixture, pendingTasksReady, projects]);236 }, [hasServerFixture, pendingTasksReady, projects]);
233237
234 useEffect(() => {238 useEffect(() => {
235 if (!SHOWCASE_ENABLED || requestedScene === null || !hasFixture || !showcaseThread) return;239 if (requestedScene === null || !hasFixture || !showcaseThread) return;
236 if (scene === requestedScene) return;240 if (scene === requestedScene) return;
237241
238 const params = {242 const params = {
...@@ -285,7 +289,7 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })...@@ -285,7 +289,7 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })
285 }, [hasFixture, navigation, requestedScene, scene, showcaseThread]);289 }, [hasFixture, navigation, requestedScene, scene, showcaseThread]);
286290
287 useEffect(() => {291 useEffect(() => {
288 if (!SHOWCASE_ENABLED || scene !== "agent-activity" || !hasFixture || agentActivityStaged) {292 if (scene !== "agent-activity" || !hasFixture || agentActivityStaged) {
289 return;293 return;
290 }294 }
291 let cancelled = false;295 let cancelled = false;
...@@ -319,7 +323,6 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })...@@ -319,7 +323,6 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })
319323
320 useEffect(() => {324 useEffect(() => {
321 if (325 if (
322 !SHOWCASE_ENABLED ||
323 scene === null ||326 scene === null ||
324 requestedScene === null ||327 requestedScene === null ||
325 scene !== requestedScene ||328 scene !== requestedScene ||
...@@ -363,7 +366,7 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })...@@ -363,7 +366,7 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })
363 themeId,366 themeId,
364 ]);367 ]);
365368
366 if (!SHOWCASE_ENABLED || readyScene === null) return null;369 if (readyScene === null) return null;
367370
368 return (371 return (
369 <View372 <View