Skip to content

fix: correct search condition for routing - #1574

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

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

Conversation

@alexdln

Copy link
Copy Markdown
Member

🔗 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

vercelBot commented Feb 22, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentActionsUpdated (UTC)
npmx.devReadyReadyPreview, CommentFeb 22, 2026 6:09pm
2 Skipped Deployments
ProjectDeploymentActionsUpdated (UTC)
docs.npmx.devIgnoredIgnoredPreviewFeb 22, 2026 6:09pm
npmx-lunariaIgnoredIgnoredFeb 22, 2026 6:09pm

Request Review

@coderabbitai

coderabbitaiBot commented Feb 22, 2026

Copy link
Copy Markdown
Contributor
📝 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 nameStatusExplanation
Description check✅ PassedThe PR description clearly relates to the changeset—it explains updating the useGlobalSearch condition to route header searches to the search page.
Linked Issues check✅ PassedThe 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✅ PassedAll 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.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Comment threadapp/composables/useGlobalSearch.ts Outdated
@codecov

codecovBot commented Feb 22, 2026

Copy link
Copy Markdown

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 linesPatch %Lines
app/composables/useGlobalSearch.ts50.00%0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

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 queueFeb 22, 2026
Merged via the queue into npmx-dev:main with commit 2ba1c5eFeb 22, 2026
17 checks passed
alex-key pushed a commit to alex-key/npmx.dev that referenced this pull request Feb 25, 2026
Sign up for freeto 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

@alexdln@danielroe