Skip to content

Commit

Permalink
fix(use-image): use useSafeLayoutEffect instead
Browse files Browse the repository at this point in the history
  • Loading branch information
wingkwong committed Jan 3, 2025
1 parent f3de678 commit e1cc1d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/hooks/use-image/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {ImgHTMLAttributes, SyntheticEvent} from "react";

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

type NativeImageProps = ImgHTMLAttributes<HTMLImageElement>;

Expand Down Expand Up @@ -95,7 +96,7 @@ export function useImage(props: UseImageProps = {}) {
}
};

useEffect(() => {
useSafeLayoutEffect(() => {
if (isHydrated) {
setStatus(setImageAndGetInitialStatus(props, imageRef));
}
Expand Down

0 comments on commit e1cc1d1

Please sign in to comment.