Skip to content

Fix LOC stat injection after GitHub redesign, switch to new store listing - #89

Merged
DervexDev merged 3 commits into
mainfrom
claude/beautiful-rubin-cdeobs
Nov 5, 2026
Merged

DervexDev merged 3 commits into
mainfrom
claude/beautiful-rubin-cdeobs

Conversation

@DervexDev

Copy link
Copy Markdown
Owner

Summary

GitHub's React repository sidebar now renders the About section twice (narrow-only and wide-only copies). The old lookup (first <h2>About</h2>) picked the hidden narrow copy, so the stat seemed to vanish. It also matched "About" headings elsewhere, which injected the stat into PR contents.

Stat injection

  • The stat is anchored to this repository's /forks stat link (the one with the repo-forked octicon). Links inside markdown, comments, PR/issue bodies, dialogs, menus and tooltips are ignored.
  • The forks row is deep-cloned, and only its icon, number and label are rewritten. The stat therefore inherits GitHub's current markup and hashed classes, so it matches the other stats across redesigns. It is injected below every forks stat, covering both the narrow and wide layouts.
  • It only runs on repo main pages (/owner/repo, /owner/repo/tree/…), and stats left over after navigating away are removed.
  • A throttled MutationObserver re-syncs idempotently, so the stat comes back after React re-renders and is never duplicated.
  • The ghloc link is now built with URL/searchParams, which fixes the broken …/repo&filter= URL when no branch was detected.
  • The stat updates live when ignored files or the access token change, and shows … while loading instead of 0.
  • Unused Stat.tsx and getFilter are removed.

Store

  • New Chrome Web Store extension ID bdjkkjhffigoaeinkkpipfhjdccimecc in release.yml and the README link.
  • New store demo images in public/store/.

Testing

  • tsc, vite build and prettier --check all pass.
  • I ran the content script in headless Chromium on the real current HTML of this repo's page at 1280px and 700px. The stat was injected once under "4 forks" in each sidebar copy, with markup identical to the forks row.
  • On a PR page (Bump @preact/preset-vite from 2.10.5 to 2.10.6 #87), nothing was injected.
  • Not yet tested in a real Chrome on live github.com.

Generated by Claude Code

claude and others added 3 commits November 4, 2026 20:16
GitHub's React sidebar renders the About section twice (narrow and wide
layouts), so the old "first h2 About" lookup injected into the hidden copy,
and loose matching injected into PR contents. The stat is now placed under
this repository's own /forks stat, cloned from it to match GitHub's
current styling, restricted to repository main pages, and re-synced
idempotently on DOM changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V85P6CD6Q6FpeJBxM5qurk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V85P6CD6Q6FpeJBxM5qurk
@DervexDev
DervexDev merged commit 5d81c87 into main Nov 5, 2026
2 checks passed
@DervexDev
DervexDev deleted the claude/beautiful-rubin-cdeobs branch November 5, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants