@nextui-org/use-image
Advanced tools
Comparing version 0.0.0-canary-20250102192808 to 0.0.0-canary-20250103142904
@@ -29,2 +29,3 @@ "use strict"; | ||
var import_react_utils = require("@nextui-org/react-utils"); | ||
var import_use_safe_layout_effect = require("@nextui-org/use-safe-layout-effect"); | ||
function useImage(props = {}) { | ||
@@ -34,5 +35,3 @@ const { onLoad, onError, ignoreFallback } = props; | ||
const imageRef = (0, import_react.useRef)(isHydrated ? new Image() : null); | ||
const [status, setStatus] = (0, import_react.useState)( | ||
() => isHydrated ? setImageAndGetInitialStatus(props, imageRef) : "pending" | ||
); | ||
const [status, setStatus] = (0, import_react.useState)("pending"); | ||
(0, import_react.useEffect)(() => { | ||
@@ -59,2 +58,7 @@ if (!imageRef.current) | ||
}; | ||
(0, import_use_safe_layout_effect.useSafeLayoutEffect)(() => { | ||
if (isHydrated) { | ||
setStatus(setImageAndGetInitialStatus(props, imageRef)); | ||
} | ||
}, [isHydrated]); | ||
return ignoreFallback ? "loaded" : status; | ||
@@ -61,0 +65,0 @@ } |
{ | ||
"name": "@nextui-org/use-image", | ||
"version": "0.0.0-canary-20250102192808", | ||
"version": "0.0.0-canary-20250103142904", | ||
"description": "React hook for progressing image loading", | ||
@@ -29,3 +29,3 @@ "keywords": [ | ||
"@nextui-org/use-safe-layout-effect": "2.1.1", | ||
"@nextui-org/react-utils": "0.0.0-canary-20250102192808" | ||
"@nextui-org/react-utils": "0.0.0-canary-20250103142904" | ||
}, | ||
@@ -32,0 +32,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9939
212
+ Added@nextui-org/react-utils@0.0.0-canary-20250103142904(transitive)
- Removed@nextui-org/react-utils@0.0.0-canary-20250102192808(transitive)