Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

fix: add useEffect to reset faviconLoaded state on link.url change

daniel31x139edb450b6ac0
diff --git a/apps/web/components/LinkViews/LinkComponents/LinkIcon.tsx b/apps/web/components/LinkViews/LinkComponents/LinkIcon.tsx
index 55d3b422..70861ca6 100644
--- a/apps/web/components/LinkViews/LinkComponents/LinkIcon.tsx
+++ b/apps/web/components/LinkViews/LinkComponents/LinkIcon.tsx
@@ -1,7 +1,7 @@
import { LinkIncludingShortenedCollectionAndTags } from "@linkwarden/types/global";
import Image from "next/image";
import isValidUrl from "@/lib/shared/isValidUrl";
-import React, { useState } from "react";
+import React, { useEffect, useState } from "react";
import Icon from "@/components/Icon";
import { IconWeight } from "@phosphor-icons/react";
import clsx from "clsx";
@@ -30,6 +30,10 @@ function LinkIcon({
const [faviconLoaded, setFaviconLoaded] = useState(false);
+ useEffect(() => {
+ setFaviconLoaded(false);
+ }, [link.url]);
+
return (
<div onClick={() => onClick && onClick()}>
{link.icon ? (