Repository navigation
perf(property-search): memoize derived search computations - #1295
Merged
nanaf6203-bit merged 2 commits intoOct 15, 2026
Merged
nanaf6203-bit merged 2 commits into
nanaf6203-bit merged 2 commits into
Conversation
|
@1Psalm Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Memoizes the derived values computed on every render of the PropertySearch component and removes a per-render array allocation from the autocomplete default, so the search box does less work on each pass.
Problem
PropertySearch recomputed showDropdown - a boolean derived from focus state, the presence of suggestions, loading state and the history flag - and rebuilt the �ctiveOptionId string on every render, including renders triggered by unrelated parent state. In addition, the autocomplete hook was destructured with a [] default, which allocated a brand new array instance on every render while the query had no data yet, invalidating any memoisation that keyed off suggestions.
Changes Made
Implementation Details
Dependencies track exactly what each derived value reads - suggestions.length rather than the array itself, since only its length affects the dropdown visibility - so the memos remain correct while avoiding recomputation on unrelated renders. The shared empty array keeps a stable identity when there are no suggestions, which is what allows consumers of suggestions to skip work. Rendered markup and autocomplete behaviour are unchanged.
Closes #1218
Closes #1217
Closes #1216
Closes #1215