Skip to content

Commit 166d7a9

Browse files
Copilotkyu08
andauthored
Fix async forEach pattern in blog card OGP fetching (#247)
* Initial plan * Fix async forEach issue - use Promise.all with map pattern Co-authored-by: kyu08 <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: kyu08 <[email protected]>
1 parent 16f8c4a commit 166d7a9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

static/blogcard.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@
174174
}
175175

176176
// ページ読み込み時に自動取得設定のあるブログカードを処理
177-
function initBlogCards() {
177+
async function initBlogCards() {
178178
log('Initializing blog cards...');
179179
const cards = document.querySelectorAll('.blogcard[data-auto-fetch="true"]');
180180
log('Found', cards.length, 'blog cards with auto-fetch');
181181

182-
cards.forEach(async (card) => {
182+
await Promise.all(Array.from(cards).map(async (card) => {
183183
const url = card.getAttribute('data-url');
184184
log('Processing card for URL:', url);
185185

@@ -203,7 +203,7 @@
203203
if (ogpData) {
204204
updateBlogCard(card, ogpData);
205205
}
206-
});
206+
}));
207207
}
208208

209209
// DOMContentLoaded後に初期化

0 commit comments

Comments
 (0)