Skip to content

Comments

fix: correct search condition for routing#1574

Merged
danielroe merged 2 commits intonpmx-dev:mainfrom
alexdln:fix/search-on-orgs-pages
Feb 22, 2026
Merged

fix: correct search condition for routing#1574
danielroe merged 2 commits intonpmx-dev:mainfrom
alexdln:fix/search-on-orgs-pages

Conversation

@alexdln
Copy link
Member

@alexdln alexdln commented Feb 22, 2026

🔗 Linked issue

resolves #1555

🧭 Context

Routing was disabled for pages with internal search

📚 Description

Updated condition to detect the place where useGlobalSearch was used and if it was in header search field - it will always navigate to search page

@vercel
Copy link

vercel bot commented Feb 22, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 22, 2026 6:09pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 22, 2026 6:09pm
npmx-lunaria Ignored Ignored Feb 22, 2026 6:09pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 22, 2026

📝 Walkthrough

Walkthrough

SearchBox.vue now calls useGlobalSearch with an explicit scope argument 'header'. The useGlobalSearch composable signature was changed to accept a place parameter ('header' | 'content', default 'content'), and its local-filter bypass conditional was refined to require place === 'content' in addition to the existing route-based check. No other public signatures were changed.

Possibly related PRs

  • npmx-dev/npmx.dev PR 1394: Touches the header search flow and global search state, modifying SearchBox integration and shared search composable.
  • npmx-dev/npmx.dev PR 1431: Introduces the useGlobalSearch composable and initial global search plumbing; directly related at the function-call and API level.
  • npmx-dev/npmx.dev PR 1450: Changes the same useGlobalSearch composable and adjusts route.query handling for searchQuery restoration.

Suggested reviewers

  • danielroe
  • ghostdevv
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The PR description clearly relates to the changeset—it explains updating the useGlobalSearch condition to route header searches to the search page.
Linked Issues check ✅ Passed The PR addresses issue #1555 by implementing the fix: updating the condition to detect header search usage and ensure navigation to search page, resolving the broken global search on org pages.
Out of Scope Changes check ✅ Passed All changes are directly scoped to resolving the linked issue: modifying the useGlobalSearch hook parameter and its conditional logic to handle header-specific routing.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

@codecov
Copy link

codecov bot commented Feb 22, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/composables/useGlobalSearch.ts 50.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
app/composables/useGlobalSearch.ts (1)

33-36: Fix is correct — one narrow edge case worth noting.

The revised condition correctly bypasses the local-filter short-circuit when place === 'header', which directly resolves the routing breakage on org/user pages.

One minor theoretical gap: isSameQuery (line 33) checks route.query.p === provider. On a local-filter page that somehow carries ?q=<term>&p=algolia in the URL, a header search for that exact term would hit the isSameQuery branch and silently skip navigation even though place === 'header'. In practice this is essentially unreachable (local-filter pages don't normally carry ?p=), but the intent could be made explicit:

🔍 Optional guard to fully close the edge case
-  const isSameQuery = route.query.q === value && route.query.p === provider
+  const isOnLocalFilterPage = pagesWithLocalFilter.has(route.name as string)
+  const isSameQuery = !isOnLocalFilterPage && route.query.q === value && route.query.p === provider
-  if ((pagesWithLocalFilter.has(route.name as string) && place === 'content') || isSameQuery) {
+  if ((isOnLocalFilterPage && place === 'content') || isSameQuery) {

@danielroe danielroe added this pull request to the merge queue Feb 22, 2026
Merged via the queue into npmx-dev:main with commit 2ba1c5e Feb 22, 2026
17 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.

Broken global search on orgs pages

2 participants