mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-07 02:58:21 +00:00
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:
parent
0bd295b10b
commit
6c203fc7df
1 changed files with 4 additions and 0 deletions
|
|
@ -142,6 +142,10 @@ export const getChatList = async (
|
|||
throw error;
|
||||
}
|
||||
|
||||
if (!res) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return res.map((chat) => ({
|
||||
...chat,
|
||||
time_range: getTimeRange(chat.updated_at)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue