Socket
Socket
Sign inDemoInstall

rc-image

Package Overview
Dependencies
Maintainers
5
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-image - npm Package Compare versions

Comparing version 7.3.0 to 7.3.1

13

es/hooks/useStatus.js

@@ -17,7 +17,13 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";

useEffect(function () {
var isCurrentSrc = true;
isImageValid(src).then(function (isValid) {
if (!isValid) {
// https://github.com/ant-design/ant-design/issues/44948
// If src changes, the previous setStatus should not be triggered
if (!isValid && isCurrentSrc) {
setStatus('error');
}
});
return function () {
isCurrentSrc = false;
};
}, [src]);

@@ -36,6 +42,3 @@ useEffect(function () {

isLoaded.current = false;
if (status !== 'loading') {
return;
}
if (img !== null && img !== void 0 && img.complete && (img.naturalWidth || img.naturalHeight)) {
if (status === 'loading' && img !== null && img !== void 0 && img.complete && (img.naturalWidth || img.naturalHeight)) {
isLoaded.current = true;

@@ -42,0 +45,0 @@ onLoad();

@@ -24,7 +24,13 @@ "use strict";

(0, _react.useEffect)(function () {
var isCurrentSrc = true;
(0, _util.isImageValid)(src).then(function (isValid) {
if (!isValid) {
// https://github.com/ant-design/ant-design/issues/44948
// If src changes, the previous setStatus should not be triggered
if (!isValid && isCurrentSrc) {
setStatus('error');
}
});
return function () {
isCurrentSrc = false;
};
}, [src]);

@@ -43,6 +49,3 @@ (0, _react.useEffect)(function () {

isLoaded.current = false;
if (status !== 'loading') {
return;
}
if (img !== null && img !== void 0 && img.complete && (img.naturalWidth || img.naturalHeight)) {
if (status === 'loading' && img !== null && img !== void 0 && img.complete && (img.naturalWidth || img.naturalHeight)) {
isLoaded.current = true;

@@ -49,0 +52,0 @@ onLoad();

{
"name": "rc-image",
"version": "7.3.0",
"version": "7.3.1",
"description": "React easy to use image component",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc