-
Notifications
You must be signed in to change notification settings - Fork 18
fix: filter release targets by search query client-side #955
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -166,7 +166,12 @@ export default function ReleaseTargetsPage() { | |
| jobStatus == null || camelCase(rt.latestJob?.status ?? "") === jobStatus; | ||
| const isMatchingVersion = | ||
| version === "all" || rt.currentVersion?.id === version; | ||
| return isMatchingJobStatus && isMatchingVersion; | ||
| const q = searchDebounced.toLowerCase(); | ||
| const isMatchingSearch = | ||
| q === "" || | ||
| rt.resource.name.toLowerCase().includes(q) || | ||
| rt.resource.identifier.toLowerCase().includes(q); | ||
| return isMatchingJobStatus && isMatchingVersion && isMatchingSearch; | ||
|
Comment on lines
+169
to
+174
|
||
| }); | ||
|
|
||
| const groupByEnvironmentId = _.groupBy( | ||
|
|
||
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.
searchDebounced.toLowerCase()is computed inside the.filter()callback, so it gets recomputed once per release target. Sinceqis constant for the whole filter operation, compute/normalize it once outside the callback (and optionallytrim()it) to avoid unnecessary work and make the filtering logic clearer.