-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: Virtualised list for search results #3722
Conversation
Removed vultr server and associated DNS entries |
5272805
to
c547ad9
Compare
c547ad9
to
b718db7
Compare
b718db7
to
53b2db7
Compare
76efb27
to
84cad19
Compare
components={{ | ||
Footer: ExternalPortalList, | ||
List: ListComponent, | ||
Item: ListItemComponent, | ||
Header: SearchHeader, |
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.
Child components are passed in via the components
prop (docs).
const ListComponent = React.forwardRef<HTMLUListElement>((props, ref) => ( | ||
<List {...props} ref={ref} sx={{ mx: 3 }} /> | ||
)) as Components<Data, Context>["List"]; | ||
|
||
/** | ||
* Accessibility - Render the Virtuoso item as a HTMLLiElement, not a HTMLDivElement | ||
*/ | ||
const ListItemComponent = React.forwardRef<HTMLLIElement>((props, ref) => ( | ||
<ListItem disablePadding sx={{ pb: 2 }} {...props} ref={ref} /> | ||
)) as Components<Data, Context>["Item"]; |
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 couldn't find a way to set this up without casting to Virtuoso types.
@@ -81,6 +81,7 @@ | |||
"react-navi-helmet-async": "^0.15.0", | |||
"react-toastify": "^9.1.3", | |||
"react-use": "^17.5.0", | |||
"react-virtuoso": "^4.10.4", |
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.
Why react-virtuoso?
- Recommended in MUI docs
- I tried the more basic react-window first and quickly found myself having a lot of CSS and layout issues - Virtuoso "just worked"
- Good score on socket.dev
- Docs were solid and clear
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.
Feels like a solid improvement ! Appreciate the why-react-virtuoso decision making notes
Only noticed a few things not related to the virtulised table changes while reviewing which I've dropped in the Slack feedback thread, this seems good to go !
Thanks @jessicamcinchak - working my way through those comments now 👍 |
What does this PR do?
SearchNodeResult
component - this is now just an item within the list (code)SearchHeader
Search
What's changed?
Previously, performance felt sluggish when a large number of search results were returned. Scrolling was slow, and the text input would frequently freeze. This is mitigated by using a debounce for the search term, but still noticeable.
Please see this example flow, with search term "user" (215 results) - https://editor.planx.dev/opensystemslab/prior-approval-scope-check
On the Pizza, this should feel a fair bit quicker - we can see in the video below that only a small number of result cards are being rendered at any given moment.
Screen.Recording.2024-09-30.at.17.01.02.mov