Skip to content

Commit

Permalink
Map search: search link does not properly open #1153
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Beloborodov committed Nov 26, 2024
1 parent 5a54ee0 commit 6d110ea
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/pages/Search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,10 @@ class SearchTabs extends React.Component {

actions.setSearches(searches);

let preload_count = entry_list.length;
const value_list = [];

for (const [key, value] of entry_list) {
if (value.subQuery) {
preload_count--;
continue;
}

Expand All @@ -417,10 +416,15 @@ class SearchTabs extends React.Component {
const additionalParamsFlag = additionalParamsCheck(value.langs, value.dicts, value.searchMetadata);

if (!checkInfo.check || (checkInfo.empty && !additionalParamsFlag)) {
preload_count--;
continue;
}

value_list.push([value, checkInfo]);
}

this.setState({ preload_count: value_list.length });

for (const [value, checkInfo] of value_list) {
client
.query({
query: searchQuery,
Expand All @@ -440,7 +444,7 @@ class SearchTabs extends React.Component {
})
.then(
({ data: { advanced_search } }) => {
this.setState({ preload_count: preload_count - 1 });
this.setState(({ preload_count }) => ({ preload_count: preload_count - 1 }));

if (this.is_mounted) {
actions.storeSearchResult(value.id, advanced_search);
Expand All @@ -449,7 +453,7 @@ class SearchTabs extends React.Component {
error_data => {
window.logger.err(this.context("Failed search query!"));
console.log(error_data);
this.setState({ preload_count: preload_count - 1 });
this.setState(({ preload_count }) => ({ preload_count: preload_count - 1 }));
}
);
}
Expand Down

0 comments on commit 6d110ea

Please sign in to comment.