-
Notifications
You must be signed in to change notification settings - Fork 650
Optimize SelectPanel filtering performance with useDeferredValue #7409
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
🦋 Changeset detectedLatest commit: 773fe7d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…ith large lists - Import useDeferredValue from React - Create deferredItems using useDeferredValue(items) - Use immediate filterValue for TextInput display (keeps typing responsive) - Use deferredItems for expensive list rendering operations - Update getItemListForEachGroup to use deferredItems - Use deferredItems in ActionList rendering (both grouped and ungrouped) - Use deferredItems for useAnnouncements to defer announcements - Keep immediate items for selectAll logic and keyboard interactions This implementation follows the same pattern as Autocomplete.tsx, where: - Immediate values are used for user-facing UI (TextInput) - Deferred values are used for expensive operations (list rendering) - React can defer the expensive work while keeping input responsive Co-authored-by: mattcosta7 <8616962+mattcosta7@users.noreply.github.com>
- Update onInputKeyDown to use deferredItems instead of items - This ensures keyboard navigation (Enter key) operates on the same deferred items that are rendered, preventing potential mismatches - Addresses code review feedback about consistency between keyboard handlers and rendered items Co-authored-by: mattcosta7 <8616962+mattcosta7@users.noreply.github.com>
|
👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the |
|
@copilot add a changeset |
Co-authored-by: mattcosta7 <8616962+mattcosta7@users.noreply.github.com>
|
Closing via #7411 |
SelectPanel experiences input lag when filtering large lists because expensive list rendering blocks keystrokes. This implements React's
useDeferredValuepattern already used in Autocomplete.Implementation
Added
useDeferredValueto FilteredActionList to separate immediate UI updates from expensive rendering:Updated to use
deferredItems:getItemListForEachGroupcallbackuseAnnouncementshookonInputKeyDownkeyboard handlerKept immediate
items:Changelog
Changed
FilteredActionListnow usesuseDeferredValuefor list rendering operations to prevent input lag with large listsRollout strategy
Testing & Reviewing
All existing SelectPanel and ActionList tests pass. The change is internal to FilteredActionList with no API changes.
A changeset has been added to document this performance improvement for the changelog.
Merge checklist
Original prompt
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.