-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
chore(Orama): move some components in @node-core/ui-components
#8352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. |
@node-core/ui-components
fb64698 to
5d881e9
Compare
There was a problem hiding this 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
keyprop for mapped suggestion items. React requires a uniquekeyprop when rendering lists. Addkey={suggestion}to theSuggestions.Itemcomponent.
packages/ui-components/src/Common/Search/Results/index.module.css:1 - The
@referencepath is incorrect. The file is atpackages/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.
packages/ui-components/src/Common/Search/Results/Empty/index.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
keyprop in the mappedSuggestions.Itemelements. The original code at line 1320 hadkey={suggestion}which was removed during the refactor. Addkey={suggestion}back to theSuggestions.Itemcomponent.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| </Modal.Root> | ||
| return ( | ||
| <SearchModal | ||
| client={oramaClient} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?)
packages/ui-components/src/Common/Search/Results/Tabs/index.tsx
Outdated
Show resolved
Hide resolved
ovflowd
left a comment
There was a problem hiding this 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
Ref: nodejs/doc-kit#487
We need to simplify + move these components in
@node-core/ui-componentsto re-use them in doc-kit. This PR moves most of these components into@node-core/ui-components.