perf : cache
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import NextImage, { type ImageProps } from "next/image";
|
||||
import { useState } from "react";
|
||||
import { useState, type Ref } from "react";
|
||||
|
||||
const CDN_ORIGIN = "https://buzz-cdn.astrxl.dev";
|
||||
|
||||
export default function ResilientImage({ src, unoptimized, onError, ...props }: ImageProps) {
|
||||
export default function ResilientImage({ src, unoptimized, onError, ...props }: ImageProps & { ref?: Ref<HTMLImageElement> }) {
|
||||
const [failedSource, setFailedSource] = useState<string | null>(null);
|
||||
const useOriginal = typeof src === "string" && failedSource === src;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user