mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
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:
parent
8df1a11535
commit
790e6da500
3 changed files with 27 additions and 5 deletions
|
@ -460,12 +460,17 @@ const ExcalidrawWrapper = () => {
|
|||
if (excalidrawAPI) {
|
||||
let didChange = false;
|
||||
|
||||
let pendingImageElement = appState.pendingImageElement;
|
||||
const elements = excalidrawAPI
|
||||
.getSceneElementsIncludingDeleted()
|
||||
.map((element) => {
|
||||
if (localFileStorage.shouldUpdateImageElementStatus(element)) {
|
||||
didChange = true;
|
||||
return newElementWith(element, { status: "saved" });
|
||||
const newEl = newElementWith(element, { status: "saved" });
|
||||
if (pendingImageElement === element) {
|
||||
pendingImageElement = newEl;
|
||||
}
|
||||
return newEl;
|
||||
}
|
||||
return element;
|
||||
});
|
||||
|
@ -473,6 +478,9 @@ const ExcalidrawWrapper = () => {
|
|||
if (didChange) {
|
||||
excalidrawAPI.updateScene({
|
||||
elements,
|
||||
appState: {
|
||||
pendingImageElement,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue