Skip to content

docs: show the GitHub star count in the nav overflow menu - #13193

Merged
jdx merged 1 commit into
mainfrom
claude/jdx-cli-issue-fixes-468675
Sep 14, 2026
Merged

jdx merged 1 commit into
mainfrom
claude/jdx-cli-issue-fixes-468675

Conversation

@jdx

@jdx jdx commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Problem

Between 768px and 1279px wide, VitePress collapses the nav bar's social links
into the "…" overflow menu. On mise.jdx.dev the GitHub star count disappeared
entirely at those widths — the menu showed a bare GitHub icon.

Cause

VitePress renders the GitHub link twice: inline in the nav bar, and again inside
the overflow menu. The badge injector used querySelector, so it always matched
the inline link — which is display: none below 1280px — and appended the badge
there. The menu's copy never got one.

Fix

Inject into every match, and disconnect the MutationObserver once each link has
its badge instead of re-running on every DOM mutation the page makes for the rest
of its life. This matches what hk, pitchfork, usage and mr-boxington already do.

No CSS change was needed: the badge sits 8px clear of the menu's clip box, so it
does not hit the clipping that jdx/pitchfork#862,
jdx/usage#1429 and
jdx/pacvamp#91 fix.

Validation

Built the docs (mise run docs:build), served the output, and drove headless
Chromium against it:

  • at 1000px the "…" menu now shows ★ 33.9k, 8px clear of the menu's clip box
  • at 1400px the inline badge's bounding box is identical to production today
    (x 1299.0, y 41, 45.9×12) and the nav bar is still 64px tall
  • the hamburger nav screen below 768px is unaffected — it had no badge before
    this change either, on mise or any of the sibling sites

AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5; version: 2.1.270.


Note

Low Risk
Docs-site nav DOM injection only; no changes to app logic, auth, or data handling.

Overview
Fixes missing GitHub star badges when VitePress moves social links into the nav "…" overflow menu (roughly 768px–1279px).

The theme injector in docs/.vitepress/theme/index.ts now uses querySelectorAll so every mise GitHub nav link gets a .star-count badge (inline + overflow copy), skips work when starsData is empty, and treats “all links badged” as success. The MutationObserver is scoped to .VPNav, disconnects once badges are on all links (instead of watching document.body on every mutation), and is torn down in onUnmounted; the old immediate + setTimeout(100) retry path is removed.

Reviewed by Cursor Bugbot for commit 40cbad9. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Bug Fixes
    • GitHub star count badges now appear on all matching GitHub links, including links in the overflow menu.
    • Badge updates now reliably handle navigation elements that load or change dynamically.
    • Badge monitoring stops once all applicable links are updated, improving behavior and preventing unnecessary ongoing activity.

VitePress renders the GitHub social link twice: inline in the nav bar, and
again inside the "..." overflow menu that replaces it between 768px and
1279px. The badge injector used `querySelector`, so it always matched the
inline link -- which is `display: none` at those widths -- and the star
count was simply missing from the menu the whole time it was the only
place the link appeared.

Inject into every match instead, and stop the MutationObserver once every
link has its badge rather than re-running on every DOM mutation the page
makes for the rest of its life.

The inline badge is unchanged: same position, same 64px nav bar.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jdx
jdx enabled auto-merge (squash) September 14, 2026 19:33
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Advanced

Run ID: 3f444468-a649-4f6c-ad58-296bd4907ad9

📥 Commits

Reviewing files that changed from the base of the PR and between 91a9573 and 40cbad9.

📒 Files selected for processing (1)
  • docs/.vitepress/theme/index.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The theme now badges every matching GitHub social link. It observes navigation changes until all links are badged, then disconnects. It also disconnects the observer when the component unmounts.

Changes

GitHub star badge lifecycle

Layer / File(s) Summary
Badge application and observer lifecycle
docs/.vitepress/theme/index.ts
The theme queries all matching GitHub links and adds badges to links without one. It returns completion status, observes .VPNav or document.body until all links are badged, and cleans up the observer on unmount.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 40cba

The GitHub badge behavior is covered across the responsive navigation variants, with no actionable merge-blocking risk identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: displaying the GitHub star count in the navigation overflow menu.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge with no actionable correctness, security, or repository-rule issues identified.

Summary

  • Adds the badge to every matching social link so both inline and overflow-menu copies receive it.
  • Stops observing DOM mutations after all rendered GitHub links have badges.
  • Disconnects any remaining observer when the theme component unmounts.

Reviews (1) · Last reviewed commit: "docs: show the GitHub star count in the ..."

@jdx
jdx merged commit d812de3 into main Sep 14, 2026
53 of 63 checks passed
@jdx
jdx deleted the claude/jdx-cli-issue-fixes-468675 branch September 14, 2026 19:53
@github-actions

Copy link
Copy Markdown

Instruction counts

Nothing was compared, and so nothing was gated. No series appears on both sides: either the base has no measurements recorded, or the two were measured on different runner classes, which are deliberately not comparable — counts shift between machine types by more than a real regression does.

New, nothing to compare against: env on jdx-perf-v1-ubuntu24.04-x64-mise-rust1.97.1-img5263c143, hook-env on jdx-perf-v1-ubuntu24.04-x64-mise-rust1.97.1-img5263c143, ls on jdx-perf-v1-ubuntu24.04-x64-mise-rust1.97.1-img5263c143, registry on jdx-perf-v1-ubuntu24.04-x64-mise-rust1.97.1-img5263c143, startup on jdx-perf-v1-ubuntu24.04-x64-mise-rust1.97.1-img5263c143

Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run.

Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.

40cbad9741bd vs ad6f9c2f3760 · measured on the runner, not pushed to the history.

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.

1 participant