fix: images not initialized correctly (#4157)
* fix: image not initialized correctly due to not renewing `state.pendingImageElement` * ensure we replace elements on update * set file as errored on >= 400 status respones
This commit is contained in:
@ -4270,12 +4270,24 @@ class App extends React.Component<AppProps, AppState> {
|
||||
if (updatedFiles.has(element.fileId)) {
|
||||
invalidateShapeForElement(element);
|
||||
}
|
||||
|
||||
if (erroredFiles.has(element.fileId)) {
|
||||
newElementWith(element, { status: "error" });
|
||||
}
|
||||
}
|
||||
}
|
||||
if (erroredFiles.size) {
|
||||
this.scene.replaceAllElements(
|
||||
this.scene.getElementsIncludingDeleted().map((element) => {
|
||||
if (
|
||||
isInitializedImageElement(element) &&
|
||||
erroredFiles.has(element.fileId)
|
||||
) {
|
||||
return newElementWith(element, {
|
||||
status: "error",
|
||||
});
|
||||
}
|
||||
return element;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
return { updatedFiles, erroredFiles };
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user