修改後
list.replaceChildren();
try {
const items = await requestItems(url);
if (!Array.isArray(items)) throw new Error("資料格式錯誤:預期為陣列");
renderItems(items);
setStatus(items.length === 0 ? "載入完成,目前沒有資料" : `成功載入 ${items.length} 筆`);
} catch (error) {
setStatus(`載入失敗:${error.message}`, "error");
}