Skip to content

Commit

Permalink
Uses better variabel names in mergeSearchedCategorizedItems function
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeibbb committed Oct 28, 2024
1 parent 52eeddf commit d44f344
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/plus/launchpad/launchpadProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -645,39 +645,39 @@ export class LaunchpadProvider implements Disposable {
}

mergeSearchedCategorizedItems(
permanent: LaunchpadCategorizedResult,
found: LaunchpadCategorizedResult | undefined,
prsOfTheLaunchpad: LaunchpadCategorizedResult,
prsOfSearch: LaunchpadCategorizedResult | undefined,
): LaunchpadCategorizedResult {
if (found == null || found?.error) {
if (permanent.items == null) {
return permanent;
if (prsOfSearch == null || prsOfSearch?.error) {
if (prsOfTheLaunchpad.items == null) {
return prsOfTheLaunchpad;
}
return {
items: permanent.items.filter(i => !i.isSearched),
timings: permanent.timings,
items: prsOfTheLaunchpad.items.filter(i => !i.isSearched),
timings: prsOfTheLaunchpad.timings,
};
}

const result = [];
const ids1 = new Set();
if (permanent.items) {
for (const item of permanent.items) {
const idsOfLaunchpadPrs = new Set();
if (prsOfTheLaunchpad.items) {
for (const item of prsOfTheLaunchpad.items) {
if (!item.isSearched) {
ids1.add(item.id);
idsOfLaunchpadPrs.add(item.id);
result.push(item);
}
}
}
for (const item of found.items) {
if (!ids1.has(item.id)) {
for (const item of prsOfSearch.items) {
if (!idsOfLaunchpadPrs.has(item.id)) {
item.isSearched = true;
result.push(item);
}
}

return {
items: result,
timings: found.timings,
timings: prsOfSearch.timings,
};
}

Expand Down

0 comments on commit d44f344

Please sign in to comment.