Skip to content

Commit a2a44af

Browse files
serrnovikclaude
andcommitted
fix(web): retry icon preview when its URL changes
Track which URL failed instead of a sticky boolean, so a failure for a previous URL no longer hides the preview after cwd changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 762c0e3 commit a2a44af

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎apps/web/src/components/settings/ProjectFaviconThumbnail.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function ProjectFaviconThumbnail(props: {
2727
readonly path: string;
2828
}) {
2929
const [ref, inView] = useInView<HTMLSpanElement>();
30-
const [failed, setFailed] = useState(false);
30+
const [failedUrl, setFailedUrl] = useState<string | null>(null);
3131
const resource = useMemo(
3232
() =>
3333
inView ? ({ _tag: "draft-workspace-file", cwd: props.cwd, path: props.path } as const) : null,
@@ -38,13 +38,13 @@ export function ProjectFaviconThumbnail(props: {
3838

3939
return (
4040
<span ref={ref} className="flex size-8 shrink-0 items-center justify-center">
41-
{url && !failed ? (
41+
{url && failedUrl !== url ? (
4242
<img
4343
alt=""
4444
className="max-h-8 max-w-8 rounded-sm object-contain"
4545
decoding="async"
4646
loading="lazy"
47-
onError={() => setFailed(true)}
47+
onError={() => setFailedUrl(url)}
4848
src={url}
4949
/>
5050
) : (

0 commit comments

Comments
 (0)