Skip to content

Commit

Permalink
updating pollForProcessingImage, using error response to log error
Browse files Browse the repository at this point in the history
  • Loading branch information
colbyfayock committed Oct 15, 2024
1 parent 80a6abb commit 116469a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 39 deletions.
2 changes: 1 addition & 1 deletion next-cloudinary/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@cloudinary-util/types": "1.5.10",
"@cloudinary-util/url-loader": "5.10.4",
"@cloudinary-util/util": "^3.3.2"
"@cloudinary-util/util": "4.0.0"
},
"devDependencies": {
"@babel/core": "^7.25.2",
Expand Down
6 changes: 5 additions & 1 deletion next-cloudinary/src/components/CldImage/CldImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ const CldImage = forwardRef<HTMLImageElement, CldImageProps>(function CldImage(p
const image = options.target as HTMLImageElement
const result = await pollForProcessingImage({ src: image.src })

if ( result ) {
if ( typeof result.error === 'string' && process.env.NODE_ENV === 'development' ) {
console.error(`[CldImage] Failed to load image ${props.src}: ${result.error}`)
}

if ( result.success ) {
setImgKey(`${defaultImgKey};${Date.now()}`);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const CldUploadWidget = ({
const isSuccess = results.event === 'success';

if ( isSuccess && typeof onUpload === 'function' ) {
if ( process.env.NODE_ENVIRONMENT === 'development' ) {
if ( process.env.NODE_ENV === 'development' ) {
console.warn('The onUpload callback is deprecated. Please use onSuccess instead.');
}
onUpload(results, widget.current);
Expand Down
43 changes: 7 additions & 36 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 116469a

Please sign in to comment.