Skip to content

fix: skip prefetching for sidebar top links#86

Merged
rsbh merged 3 commits into
mainfrom
fix/prefetch-skip-top-links
May 19, 2026
Merged

fix: skip prefetching for sidebar top links#86
rsbh merged 3 commits into
mainfrom
fix/prefetch-skip-top-links

Conversation

@rsbh
Copy link
Copy Markdown
Member

@rsbh rsbh commented May 19, 2026

Summary

  • Add data-no-prefetch attribute check in PrefetchProvider (mouseover, focusin, IntersectionObserver)
  • Apply data-no-prefetch to content and API top links in sidebar — these are index routes that return 404 from /api/page

Test plan

  • Hovering sidebar top links no longer triggers /api/page calls
  • Regular doc page links still prefetch on hover
  • No 404 errors in network tab from prefetcher

🤖 Generated with Claude Code

Add data-no-prefetch attribute check in PrefetchProvider to skip
links that shouldn't be prefetched. Apply to content and API top
links in sidebar which are index routes, not doc pages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chronicle Ready Ready Preview, Comment May 19, 2026 5:03am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Review Change Stack

Warning

Rate limit exceeded

@rsbh has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 42 minutes and 22 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9b6ac597-ef1d-4e9d-bd09-87ea4e31db3e

📥 Commits

Reviewing files that changed from the base of the PR and between 2b2013b and 548c9a4.

📒 Files selected for processing (1)
  • packages/chronicle/src/components/ui/PrefetchProvider.tsx
📝 Walkthrough

Walkthrough

PrefetchProvider's link prefetching logic now respects a data-no-prefetch opt-out attribute on anchor elements. Both event handlers and the initial link observer query are updated to skip prefetching for marked links. The default layout applies this attribute to sidebar documentation and API link entries.

Changes

Link Prefetch Opt-out Mechanism

Layer / File(s) Summary
PrefetchProvider opt-out mechanism
packages/chronicle/src/components/ui/PrefetchProvider.tsx
Mouseover and focusin handlers check for data-no-prefetch attribute and early-return before prefetching. The observed-link selector is updated to exclude a[href][data-no-prefetch] elements from IntersectionObserver registration.
Apply opt-out to sidebar links
packages/chronicle/src/themes/default/Layout.tsx
RouterLink components for sidebar "top links" entries (both documentation and API sections) now include the data-no-prefetch attribute.

Possibly Related PRs

  • raystack/chronicle#83: Introduced the initial PrefetchProvider hover/focus/viewport prefetch behavior that this PR extends with opt-out support.
  • raystack/chronicle#37: Refactored the default Layout.tsx to introduce the sidebar "top links" RouterLink sections that now receive the data-no-prefetch attribute.

Suggested Reviewers

  • rohilsurana
  • rohanchkrabrty

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a mechanism to skip prefetching for sidebar top links, which is the primary focus across both modified files.
Description check ✅ Passed The description is directly related to the changeset, explaining both the technical implementation (data-no-prefetch attribute check) and the rationale (sidebar top links returning 404).
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/prefetch-skip-top-links

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 and usage tips.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rsbh rsbh merged commit 84c4d8a into main May 19, 2026
4 checks passed
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