Skip to content

Commit ee53120

Browse files
authored
fix: server image loading failure (#534)
* fix: server image loading failure * docs: update notes
1 parent ee0bbce commit ee53120

4 files changed

Lines changed: 13 additions & 0 deletions

File tree

docs/content.en/docs/release-notes/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Information about release notes of Coco Server is provided here.
5454
- style: history component styles #528
5555
- fix: app icon & category icon #529
5656
- style: search error styles #533
57+
- fix: server image loading failure #534
5758

5859
## 0.4.0 (2025-04-27)
5960

src/components/Assistant/ServerList.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ export function ServerList({
205205
src={server?.provider?.icon || logoImg}
206206
alt={server.name}
207207
className="w-6 h-6 rounded-full bg-gray-100 dark:bg-gray-800"
208+
onError={(e) => {
209+
const target = e.target as HTMLImageElement;
210+
target.src = logoImg;
211+
}}
208212
/>
209213
<div className="text-left flex-1 min-w-0">
210214
<div className="text-sm font-medium text-gray-900 dark:text-gray-100 truncate max-w-[200px]">

src/components/Cloud/Cloud.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@ export default function Cloud() {
319319
width="100%"
320320
src={currentService?.provider?.banner || bannerImg}
321321
alt="banner"
322+
onError={(e) => {
323+
const target = e.target as HTMLImageElement;
324+
target.src = bannerImg;
325+
}}
322326
/>
323327
</div>
324328
<div className="flex items-center justify-between mb-4">

src/components/Cloud/Sidebar.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ export const Sidebar = forwardRef<{ refreshData: () => void }, SidebarProps>(
3838
src={item?.provider?.icon || cocoLogoImg}
3939
alt="LogoImg"
4040
className="w-5 h-5 flex-shrink-0"
41+
onError={(e) => {
42+
const target = e.target as HTMLImageElement;
43+
target.src = cocoLogoImg;
44+
}}
4145
/>
4246
<span className="font-medium truncate max-w-[140px]">{item?.name}</span>
4347
<div className="flex-1" />

0 commit comments

Comments
 (0)