-
Notifications
You must be signed in to change notification settings - Fork 135
feat: add pagination to knowledge search #11527
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
Conversation
front/components/assistant/conversation/input_bar/InputBarAttachmentsPicker.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.
Looks 🔥 left a few minor comments
Thinking out loud here, but don't you think we might want to display a message like "Showing 25 results out of ..."?
front/components/assistant/conversation/input_bar/InputBarAttachmentsPicker.tsx
Outdated
Show resolved
Hide resolved
front/components/assistant/conversation/input_bar/InputBarAttachmentsPicker.tsx
Outdated
Show resolved
Hide resolved
search: searchQuery, | ||
viewType: "all", | ||
disabled: isSpacesLoading || !searchQuery, | ||
spaceIds: spaces.map((s) => s.sId), |
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.
Let's maybe extract it with a useMemo
?
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.
I might miss something but will it be worth doing it here? 🤔 (in some places I just threw useMemo for now but if we improve the code structure for this Inputbar we can probably remove some of them, but this would take me to another rabbit hole so I wouldn't touch it for now)
front/components/assistant/conversation/input_bar/InputBarAttachmentsPicker.tsx
Outdated
Show resolved
Hide resolved
f652feb
to
f00f799
Compare
front/lib/swr/spaces.ts
Outdated
@@ -782,3 +783,82 @@ export function useSpacesSearch({ | |||
nextPageCursor: data?.nextPageCursor || null, | |||
}; | |||
} | |||
|
|||
export function useSpaceSearchWithInfiniteScroll({ |
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.
Random question: Is there a reason you created a new hook and not extended the existing useSpacesSearch
?
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.
hm they are actually quite different and I think it's better have separate hooks for them? 🤔
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.
(video looks great \o/)
Co-authored-by: Jules Belveze <[email protected]>
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.
Looks good 🔥
front/lib/swr/spaces.ts
Outdated
|
||
params.append("limit", pageSize.toString()); | ||
|
||
if (previousPageData && previousPageData?.nextPageCursor) { |
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.
if (previousPageData && previousPageData?.nextPageCursor) { | |
if (previousPageData && previousPageData.nextPageCursor) { |
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.
I will just keep previousPageData?.nextPageCursor
:D
Description
This PR is to add pagination when you search knowledge in the input. I also updated InfiniteScroll component and left some comments in the code.
To show the loading state this is throttled:
Screen.Recording.2025-03-21.at.15.00.21.mov
Tests
Manual test and I need your help to test SearchMemberPopover to see if I don't break anything
Risk
Deploy Plan