Skip to content

Conversation

@avivkeller
Copy link
Member

@avivkeller avivkeller commented Nov 14, 2025

Ref: nodejs/doc-kit#487


We need to simplify + move these components in @node-core/ui-components to re-use them in doc-kit. This PR moves most of these components into @node-core/ui-components.

@vercel
Copy link

vercel bot commented Nov 14, 2025

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

Project Deployment Preview Updated (UTC)
nodejs-org Ready Ready Preview Nov 15, 2025 6:19pm

@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.72%. Comparing base (4c1a417) to head (0685173).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8352      +/-   ##
==========================================
- Coverage   76.77%   76.72%   -0.05%     
==========================================
  Files         118      118              
  Lines        9828     9828              
  Branches      336      337       +1     
==========================================
- Hits         7545     7541       -4     
- Misses       2281     2285       +4     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@avivkeller avivkeller force-pushed the wip-orama-in-ui-components branch from fb64698 to 5d881e9 Compare November 15, 2025 02:04
@avivkeller avivkeller marked this pull request as ready for review November 15, 2025 02:04
Copilot AI review requested due to automatic review settings November 15, 2025 02:04
@avivkeller avivkeller requested review from a team as code owners November 15, 2025 02:04
@avivkeller avivkeller added the github_actions:pull-request Trigger Pull Request Checks label Nov 15, 2025
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Nov 15, 2025
Copilot finished reviewing on behalf of avivkeller November 15, 2025 02:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors Orama search functionality by extracting search-related components from the site application into the @node-core/ui-components package, making them reusable across projects. It adds @orama/ui and @orama/core dependencies and removes several site-specific implementations in favor of the new shared components.

  • Extracts Search, SearchInput, SearchResults, SearchModal, and ChatInput components to the ui-components package
  • Removes custom searchbox state management (reducer and provider) in favor of simpler local state
  • Simplifies responsive behavior by removing mobile-specific top bar and consolidating layouts

Reviewed Changes

Copilot reviewed 33 out of 36 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pnpm-lock.yaml Adds @orama/ui and @orama/core dependencies to ui-components package
packages/ui-components/package.json Declares new Orama dependencies
packages/ui-components/src/Common/Search/* New reusable search components including Input, Results, Modal, and Chat subcomponents
apps/site/components/Common/Searchbox/index.tsx Refactored to use new shared components with simplified state management
apps/site/types/searchbox.ts Removed (types no longer needed with simpler state management)
apps/site/reducers/searchboxReducer.ts Removed (replaced by useState)
apps/site/providers/searchboxProvider.tsx Removed (replaced by useState)
apps/site/components/Common/Searchbox/Search/* Removed (moved to ui-components)
apps/site/components/Common/Searchbox/MobileTopBar/* Removed (mobile/desktop now use same layout)
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (3)

packages/ui-components/src/Common/Search/Chat/Input/index.tsx:41

  • The suggestions should only be shown when there are NO interactions (!interactions?.length), but the condition is inverted to !!interactions?.length. This means suggestions will be shown when there ARE interactions, which is the opposite of the intended behavior.
    packages/ui-components/src/Common/Search/Chat/Input/index.tsx:46
  • Missing key prop for mapped suggestion items. React requires a unique key prop when rendering lists. Add key={suggestion} to the Suggestions.Item component.
    packages/ui-components/src/Common/Search/Results/index.module.css:1
  • The @reference path is incorrect. The file is at packages/ui-components/src/Common/Search/Results/index.module.css, so the path should be "../../../styles/index.css" (3 levels up) not "../../../../styles/index.css" (4 levels up).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 37 out of 40 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (2)

packages/ui-components/src/Common/Search/Chat/Input/index.tsx:49

  • The conditional logic has been inverted from the original code. Previously, suggestions were shown when !hasInteractions (no interactions), but now they're shown when !!interactions?.length (interactions exist). This should be {!interactions?.length && ( to maintain the original behavior of showing suggestions only when there are no interactions yet.
    packages/ui-components/src/Common/Search/Chat/Input/index.tsx:47
  • Missing key prop in the mapped Suggestions.Item elements. The original code at line 1320 had key={suggestion} which was removed during the refactor. Add key={suggestion} back to the Suggestions.Item component.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

</Modal.Root>
return (
<SearchModal
client={oramaClient}
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't we make a React Provider? Passing a full blown instance I'm unsure I'm a fan of that.

Provider could also be set on ui-components.

Copy link
Member Author

Choose a reason for hiding this comment

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

The full blown instances is being passed to Orama anyway, and it's not being passed from client to server iirc, so this should be fine?

Once #8245 lands I can double check

Copy link
Member

Choose a reason for hiding this comment

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

🤔 still feels a provider would make more sense as all other things also use a provider?

Copy link
Member

Choose a reason for hiding this comment

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

(Could even merge providers maybe?)

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

Left a few nits and suggestions, otherwise SGTM

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.

3 participants