We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9a88774 commit cfd122dCopy full SHA for cfd122d
packages/hooks/use-image/src/index.ts
@@ -72,10 +72,12 @@ export function useImage(props: UseImageProps = {}) {
72
73
const imageRef = useRef<HTMLImageElement | null>(isHydrated ? new Image() : null);
74
75
- const [status, setStatus] = useState<Status>(() => setImageAndGetInitialStatus(props, imageRef));
+ const [status, setStatus] = useState<Status>(() =>
76
+ isHydrated ? setImageAndGetInitialStatus(props, imageRef) : "pending",
77
+ );
78
79
useSafeLayoutEffect(() => {
- if (isHydrated) {
80
+ if (!isHydrated) {
81
return;
82
}
83
0 commit comments