From ef4574d223aafc630cb2337c073aa769029d24d0 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Mon, 9 Mar 2026 18:24:54 -0700 Subject: [PATCH] fix: auto-switch to page with most content when current page has trivial shapes Previously the page-switch logic only triggered when the current page had 0 shapes. The R2 data has 283 shapes on page:QZw03khAAJ7jNX7zQND64 but only 1 (MycelialIntelligence) on page:page. Since page:page is the default, users saw only the MI shape, not their content. Now also switches when current page has <=2 shapes but another page has >10. Co-Authored-By: Claude Opus 4.6 --- src/routes/Board.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/routes/Board.tsx b/src/routes/Board.tsx index 15e1e36..4f209a7 100644 --- a/src/routes/Board.tsx +++ b/src/routes/Board.tsx @@ -859,8 +859,16 @@ export function Board() { } }) - // If current page has no shapes but another page does, switch to that page - if (editorShapes.length === 0 && pageWithMostShapes && pageWithMostShapes !== currentPageId) { + // If current page has very few shapes but another page has significantly more, switch to that page + // This handles the case where a default page:page exists with just 1-2 shapes + // but the real content is on a different page (e.g. page:QZw03khAAJ7jNX7zQND64) + const currentPageShapeCount = editorShapes.length + const shouldSwitchPage = pageWithMostShapes && pageWithMostShapes !== currentPageId && ( + currentPageShapeCount === 0 || // No shapes on current page + (maxShapes > 10 && currentPageShapeCount <= 2) // Current page has trivial content, other page has real content + ) + if (shouldSwitchPage) { + console.log(`📊 Board: Switching from ${currentPageId} (${currentPageShapeCount} shapes) to ${pageWithMostShapes} (${maxShapes} shapes)`) try { editor.setCurrentPage(pageWithMostShapes as any) // Focus camera on shapes after switching