Skip to content

Commit

Permalink
feat: clear old search results when a new search starts
Browse files Browse the repository at this point in the history
  • Loading branch information
fterra-encora committed Oct 29, 2024
1 parent 65ecc1a commit 6c5e15e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/src/components/DataFetcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ watch([() => props.url, () => props.disabled], () => {
clearTimeout(debounceTimer);
}
debounceTimer = setTimeout(() => {
content.value = [];
fetch().then(() => {
// Discard the response from old request when a newer one was already responded.
if (curRequestTime >= lastUpdateRequestTime.value) {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/pages/SearchPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ const searchResultToCodeNameValue = (
return result;
};
const searchResultToCodeNameValueList = (list: ClientSearchResult[]) => list.map(searchResultToCodeNameValue);
const searchResultToCodeNameValueList = (list: ClientSearchResult[]) =>
list?.map(searchResultToCodeNameValue);
const searchResultToText = (searchResult: ClientSearchResult): string => {
const { clientNumber, clientFullName, clientType, city } = searchResult;
Expand Down

0 comments on commit 6c5e15e

Please sign in to comment.