Skip to content

Commit

Permalink
fix: ImagePreview refresh problem when onload of multiple pictures …
Browse files Browse the repository at this point in the history
…is triggered at the same time (#173)
  • Loading branch information
yeling authored Sep 21, 2023
1 parent e452e40 commit c71c526
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/arcodesign/components/image-preview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -852,12 +852,14 @@ const ImagePreview = forwardRef((props: ImagePreviewProps, ref: Ref<ImagePreview
* @en Change specified image status
*/
function setImagesStatusByIndex(index: number, data: PreviewImageStatus) {
const newStatus = imagesStatusRef.current.slice();
newStatus[index] = {
...(newStatus[index] || {}),
...data,
};
setImagesStatus(newStatus);
setImagesStatus(current => {
const newStatus = current.slice();
newStatus[index] = {
...(newStatus[index] || {}),
...data,
};
return newStatus;
});
}

/**
Expand Down

0 comments on commit c71c526

Please sign in to comment.