Skip to content

Commit 239b7eb

Browse files
authored
Update horizontalGrid with downloadPromises
Adapted from SteamGridDB#117
1 parent ff0cd1a commit 239b7eb

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/js/Search.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,16 @@ class Search extends React.Component {
6767
items: clonedItems,
6868
});
6969

70-
//Add horizontalGrid BPM image for Non-Steam Games
70+
const downloadPromises = [];
71+
72+
downloadPromises.push(Steam.addAsset(location.state.assetType, game.appid, item.url));
73+
74+
// Add horizontalGrid BPM image for Non-Steam Games
7175
if (game.appidold && location.state.assetType == 'horizontalGrid') {
72-
Steam.addAsset(location.state.assetType, game.appidold, item.url);
76+
downloadPromises.push(Steam.addAsset(location.state.assetType, game.appidold, item.url));
7377
}
74-
75-
Steam.addAsset(location.state.assetType, game.appid, item.url).then(() => {
78+
79+
Promise.all(downloadPromises).then(() => {
7680
clonedItems[itemIndex].downloading = false;
7781
this.setState({
7882
items: clonedItems,

0 commit comments

Comments
 (0)