fix: prevent getChatList crash on null API response (#20269)

Add null check before calling .map() on the API response in getChatList(). When the fetch fails silently or returns null, the function now gracefully returns an empty array instead of crashing with 'Cannot read property map of null'.
This commit is contained in:
Classic298
2025-12-31 14:41:27 +01:00
committed by GitHub
parent 0bd295b10b
commit 6c203fc7df

View File

@@ -142,6 +142,10 @@ export const getChatList = async (
throw error;
}
if (!res) {
return [];
}
return res.map((chat) => ({
...chat,
time_range: getTimeRange(chat.updated_at)