diff --git a/e2e/chunks.spec.ts b/e2e/chunks.spec.ts index 155e71f0..ac1f810d 100644 --- a/e2e/chunks.spec.ts +++ b/e2e/chunks.spec.ts @@ -190,18 +190,21 @@ const signInPages = [ }); } }, - { - // The first visit to a password-protected honk: no profile until discovery saves one. At phone width, since from - // 1024 px the sidebar's widget panel shares the Activity chunk. - name: 'a hosted backend on first visit', + // The first visit to a password-protected honk: no profile until discovery saves one. From 1024 px the sidebar hosts + // the widget panel, whose code shares the Activity chunk. + ...[ + {width: 1280, height: 800}, + {width: 390, height: 844} + ].map(viewport => ({ + name: `a hosted backend on first visit at ${viewport.width}`, pages: ['activity', ...pageChunks], - viewport: {width: 390, height: 844}, + viewport, ready: (page: Page) => page.getByRole('heading', {name: 'Token required'}), async setup(page: Page) { await page.route('**/api', route => route.fulfill(challenge)); await page.route('**/api/v1/**', route => route.fulfill(challenge)); } - } + })) ]; for (const {name, pages, viewport, ready, setup} of signInPages) { diff --git a/src/shell/widgets/host.tsx b/src/shell/widgets/host.tsx index 675e00b4..b30cac86 100644 --- a/src/shell/widgets/host.tsx +++ b/src/shell/widgets/host.tsx @@ -1,5 +1,6 @@ import {lazy, Suspense, useState, useSyncExternalStore, type ReactNode} from 'react'; import {useT} from '../../i18n'; +import {useCapabilities} from '../../store'; import {Button, VisuallyHidden, phoneQuery, sidebarQuery, useMediaQuery} from '../../ui/ui'; import {LoadBoundary} from '../../ui/LoadBoundary'; import WidgetsIcon from '../../ui/icons/Widgets'; @@ -34,7 +35,10 @@ export function SidebarWidgets({route, backend, honk}: {route: string; backend: const phone = useMediaQuery(phoneQuery); const layout = useWidgetLayout(); const [announcement, setAnnouncement] = useState({text: '', serial: 0}); - const shown = !phone && layout.visible; + // The panel shows backend data, so it mounts once the backend accepts the tab, as the pages warm; before that the + // frame painted during sign-in would download its code. + const accepted = !!useCapabilities().data; + const shown = accepted && !phone && layout.visible; const docked = sidebar && !!layout.docked; const indicator = ; const panel = (