mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: stale appState.pendingImageElement
(#5322)
* fix: stale `appState.pendingImageElement` * unrelated fix for devTools race conditions * snap fix
This commit is contained in:
parent
fd48c2cf79
commit
4712393b62
9 changed files with 107 additions and 103 deletions
|
@ -479,19 +479,17 @@ const ExcalidrawWrapper = () => {
|
|||
if (excalidrawAPI) {
|
||||
let didChange = false;
|
||||
|
||||
let pendingImageElement = appState.pendingImageElement;
|
||||
const elements = excalidrawAPI
|
||||
.getSceneElementsIncludingDeleted()
|
||||
.map((element) => {
|
||||
if (
|
||||
LocalData.fileStorage.shouldUpdateImageElementStatus(element)
|
||||
) {
|
||||
didChange = true;
|
||||
const newEl = newElementWith(element, { status: "saved" });
|
||||
if (pendingImageElement === element) {
|
||||
pendingImageElement = newEl;
|
||||
const newElement = newElementWith(element, { status: "saved" });
|
||||
if (newElement !== element) {
|
||||
didChange = true;
|
||||
}
|
||||
return newEl;
|
||||
return newElement;
|
||||
}
|
||||
return element;
|
||||
});
|
||||
|
@ -499,9 +497,6 @@ const ExcalidrawWrapper = () => {
|
|||
if (didChange) {
|
||||
excalidrawAPI.updateScene({
|
||||
elements,
|
||||
appState: {
|
||||
pendingImageElement,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue