diff --git a/src/app/game/berry-dash/chatroom/page.tsx b/src/app/game/berry-dash/chatroom/page.tsx index 8918f30..fea7290 100644 --- a/src/app/game/berry-dash/chatroom/page.tsx +++ b/src/app/game/berry-dash/chatroom/page.tsx @@ -95,27 +95,29 @@ export default function BerryDashChatroom () { .map(id => `"${id}"`) .join(',') - ;(async () => { - const result = await axios.get( - `/api/berrydash/icon-marketplace/icon?ids=[${notInAllIds}]` - ) - if (result.data.success) { - const add: CustomIconEntry[] = [] - for (const item of result.data.data) { - add.push({ - data: item.data, - id: item.id - }) + if (notInAllIds.length != 0) { + ;(async () => { + const result = await axios.get( + `/api/berrydash/icon-marketplace/icon?ids=[${notInAllIds}]` + ) + if (result.data.success) { + const add: CustomIconEntry[] = [] + for (const item of result.data.data) { + add.push({ + data: item.data, + id: item.id + }) + } + setCustomIconCache(prev => [ + ...prev, + ...result.data.data.map((item: CustomIconEntry) => ({ + data: item.data, + id: item.id + })) + ]) } - setCustomIconCache(prev => [ - ...prev, - ...result.data.data.map((item: CustomIconEntry) => ({ - data: item.data, - id: item.id - })) - ]) - } - })() + })() + } }, [messages]) return (