Skip to content

Commit

Permalink
Fetch patches for packages only if list is populated (#2893)
Browse files Browse the repository at this point in the history
* Fetch patches for packages only if list is populated

* Instantiate package IDs only if upgradable packages has items
  • Loading branch information
dottorblaster authored Aug 20, 2024
1 parent ac119df commit 0cfcabc
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ function UpgradablePackagesPage() {
);

useEffect(() => {
const packageIDs = upgradablePackages.map(
({ to_package_id: packageID }) => packageID
);
if (upgradablePackages.length) {
const packageIDs = upgradablePackages.map(
({ to_package_id: packageID }) => packageID
);

dispatch(fetchUpgradablePackagesPatches({ hostID, packageIDs }));
dispatch(fetchUpgradablePackagesPatches({ hostID, packageIDs }));
}
}, [upgradablePackages.length, hostID]);

return (
Expand Down

0 comments on commit 0cfcabc

Please sign in to comment.