mirror of
https://github.com/linkwarden/linkwarden.git
synced 2026-03-03 00:37:00 +00:00
fix: add useEffect to reset faviconLoaded state on link.url change
This commit is contained in:
@@ -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 ? (
|
||||
|
||||
Reference in New Issue
Block a user