Skip to content

fix: replace useDocsPreferredVersion with useActiveVersion#553

Merged
weareoutman merged 1 commit intomasterfrom
steve/fix-active-version
Jan 29, 2026
Merged

fix: replace useDocsPreferredVersion with useActiveVersion#553
weareoutman merged 1 commit intomasterfrom
steve/fix-active-version

Conversation

@weareoutman
Copy link
Member

@weareoutman weareoutman commented Jan 29, 2026

Fixes #467 #552

Summary by CodeRabbit

  • Refactor
    • Improved the internal version resolution mechanism in the search bar component for enhanced stability and maintainability.

✏️ Tip: You can customize this high-level summary in your review settings.

@netlify
Copy link

netlify bot commented Jan 29, 2026

Deploy Preview for easyops-cn-docusaurus-search-local ready!

Name Link
🔨 Latest commit 15ba30d
🔍 Latest deploy log https://app.netlify.com/projects/easyops-cn-docusaurus-search-local/deploys/697b1907266765720c0ac1ee
😎 Deploy Preview https://deploy-preview-553--easyops-cn-docusaurus-search-local.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

Walkthrough

The SearchBar component's version resolution logic has been refactored to use useActiveVersion instead of useDocsPreferredVersion, eliminating associated error handling. Import statements have been updated accordingly, replacing dependencies from @docusaurus/theme-common with @docusaurus/plugin-content-docs/client.

Changes

Cohort / File(s) Summary
SearchBar Component Refactoring
docusaurus-search-local/src/client/theme/SearchBar/SearchBar.tsx
Replaced version resolution mechanism from useDocsPreferredVersion to useActiveVersion. Removed try-catch error handling flow and direct error handling for ReactContextError. Updated imports to use useActiveVersion from @docusaurus/plugin-content-docs/client, and removed unused indexDocs import. Minor JSX formatting adjustments applied.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: replacing useDocsPreferredVersion with useActiveVersion, which is the core objective of the PR.
Linked Issues check ✅ Passed The PR addresses issue #467 about search context inconsistency by replacing useDocsPreferredVersion with useActiveVersion, which improves version resolution reliability.
Out of Scope Changes check ✅ Passed All changes are directly related to replacing useDocsPreferredVersion with useActiveVersion; no unrelated modifications detected.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

@weareoutman weareoutman merged commit 7e72ef4 into master Jan 29, 2026
6 of 7 checks passed
@weareoutman weareoutman deleted the steve/fix-active-version branch January 29, 2026 08:26
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.

Search context sometimes doesn't get applied correctly

1 participant