Skip to content

Commit 1239c07

Browse files
committed
chore(use-image): remove unneccessary code
1 parent cfd122d commit 1239c07

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

packages/hooks/use-image/src/index.ts

+1-14
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type {ImgHTMLAttributes, SyntheticEvent} from "react";
66

77
import {useRef, useState, useEffect, MutableRefObject} from "react";
88
import {useIsHydrated} from "@nextui-org/react-utils";
9-
import {useSafeLayoutEffect} from "@nextui-org/use-safe-layout-effect";
109

1110
type NativeImageProps = ImgHTMLAttributes<HTMLImageElement>;
1211

@@ -66,7 +65,7 @@ type ImageEvent = SyntheticEvent<HTMLImageElement, Event>;
6665
*/
6766

6867
export function useImage(props: UseImageProps = {}) {
69-
const {loading, src, srcSet, onLoad, onError, crossOrigin, sizes, ignoreFallback} = props;
68+
const {onLoad, onError, ignoreFallback} = props;
7069

7170
const isHydrated = useIsHydrated();
7271

@@ -76,18 +75,6 @@ export function useImage(props: UseImageProps = {}) {
7675
isHydrated ? setImageAndGetInitialStatus(props, imageRef) : "pending",
7776
);
7877

79-
useSafeLayoutEffect(() => {
80-
if (!isHydrated) {
81-
return;
82-
}
83-
84-
setStatus(setImageAndGetInitialStatus(props, imageRef));
85-
86-
return () => {
87-
flush();
88-
};
89-
}, [src, crossOrigin, srcSet, sizes, loading]);
90-
9178
useEffect(() => {
9279
if (!imageRef.current) return;
9380
imageRef.current.onload = (event) => {

0 commit comments

Comments
 (0)