From e05eae84be5661dee364bc9ea98771ac782e7e85 Mon Sep 17 00:00:00 2001 From: Omar Kurt Date: Sat, 7 Nov 2026 08:21:20 +0300 Subject: [PATCH] fix repo panel rendering on top of repo content again findRepoSidebar fell back to main, which always exists, so waitFor resolved before React rendered the About pane. Only use content fallbacks after the wait times out, and make the borderGrid selector hash-agnostic. Fixes #17 --- .../extension/entrypoints/github-panel.content.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/extension/entrypoints/github-panel.content.ts b/packages/extension/entrypoints/github-panel.content.ts index 2b2fb10..493d1c6 100644 --- a/packages/extension/entrypoints/github-panel.content.ts +++ b/packages/extension/entrypoints/github-panel.content.ts @@ -674,7 +674,7 @@ const findRepoSidebar = (): Element | null => { // New React code-view layout: About sidebar lives in a SplitPageLayout pane const sidebarSelectors = [ '[data-component="SplitPageLayout.Pane"]', - '[class*="CodeViewSidebar-module__borderGrid"]', + '[class*="CodeViewSidebar-module"][class*="borderGrid"]', ".Layout-sidebar", 'aside[role="complementary"]', ".BorderGrid", @@ -685,7 +685,12 @@ const findRepoSidebar = (): Element | null => { if (el) return el; } - // Fallback: find the main content area of the repo page + return null; +}; + +// Last resort when the sidebar never renders. Kept separate from findRepoSidebar: +// `main` always exists, so mixing it in made waitFor resolve before React hydrated the About pane. +const findRepoContentFallback = (): Element | null => { const fallbackSelectors = ["#repo-content-turbo-frame", ".repository-content", "main"]; for (const selector of fallbackSelectors) { @@ -898,7 +903,7 @@ const loadPanel = async (): Promise => { // Repo pages: no author detection needed, show repo context directly if (parsed.type === "repo") { - const repoTarget = await waitFor(findRepoSidebar, 10, 300); + const repoTarget = (await waitFor(findRepoSidebar, 10, 300)) ?? findRepoContentFallback(); if (!repoTarget || isStale()) return; injectPanel( buildSinglePanel("Repository", 'Loading...'),