Skip to content

Commit e1cc1d1

Browse files
committed
fix(use-image): use useSafeLayoutEffect instead
1 parent f3de678 commit e1cc1d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ 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";
910

1011
type NativeImageProps = ImgHTMLAttributes<HTMLImageElement>;
1112

@@ -95,7 +96,7 @@ export function useImage(props: UseImageProps = {}) {
9596
}
9697
};
9798

98-
useEffect(() => {
99+
useSafeLayoutEffect(() => {
99100
if (isHydrated) {
100101
setStatus(setImageAndGetInitialStatus(props, imageRef));
101102
}

0 commit comments

Comments
 (0)