perf: leave the Pro frame's panes empty on standard pages

This commit is contained in:
Linus Rath
2026-11-02 19:55:32 +01:00
parent 3db7b745d0
commit b623cd388d
2 changed files with 9 additions and 7 deletions
@@ -55,9 +55,9 @@ describe('AppShellSkeleton under the Pro interface', () => {
const [strip, body] = [...pane.children];
expect(strip.querySelectorAll('[data-sk-pro-tab]')).toHaveLength(8);
expect(classes(strip)).toEqual(expect.arrayContaining(['h-9', 'bg-secondary']));
// A page Pro takes over only draws its own body: the redirect focuses
// its tab. (The /pro page draws all of them, see ProSkeleton below.)
expect([...body.children].map((b) => b.getAttribute('data-sk-pro-body'))).toEqual(['calendar', 'other']);
// A page Pro takes over draws its panes empty, to keep its HTML small.
// (The /pro page draws every body, see ProSkeleton below.)
expect([...body.children].map((b) => b.getAttribute('data-sk-pro-body'))).toEqual(['other']);
}
// The split pane only shows with a split.
expect(classes(panes[1])).toEqual(expect.arrayContaining(['hidden', 'boot-pro-split:flex']));
+6 -4
View File
@@ -96,13 +96,15 @@ export function ProFrameSkeleton({
}: ProSkeletonProps & {
className?: string;
/**
* The page Pro is taking over. Its tab is the one the redirect focuses, so
* only its body is drawn (a pane whose stored tab shows another page stays
* empty), which keeps every standard page's HTML from carrying all five.
* Set when this frame stands in for a standard page Pro is about to take
* over. Its panes are then drawn empty (tab strips only): the frame doesn't
* move on the hop to /pro, and the page's body, which would otherwise be in
* every standard page's HTML a second and third time for the few who use
* Pro, fills in once /pro has loaded. /pro's own HTML draws the bodies.
*/
surface?: BootSurface;
}) {
const bodies = surface && BODIES.includes(surface) ? [surface] : BODIES;
const bodies = surface ? [] : BODIES;
return (
<SkeletonRegion
surface="pro"