mirror of
https://github.com/excalidraw/excalidraw.git
synced 2024-11-02 03:25:53 +01:00
fix: clear image/shape cache of affected elements when adding files (#4089)
This commit is contained in:
parent
7dbd0c5e0a
commit
5c5b8c517f
@ -1520,19 +1520,23 @@ class App extends React.Component<AppProps, AppState> {
|
||||
}, new Map<FileId, BinaryFileData>());
|
||||
|
||||
this.files = { ...this.files, ...Object.fromEntries(filesMap) };
|
||||
this.addNewImagesToImageCache();
|
||||
|
||||
// bump versions for elements that reference added files so that
|
||||
// we/host apps can detect the change
|
||||
// we/host apps can detect the change, and invalidate the image & shape
|
||||
// cache
|
||||
this.scene.getElements().forEach((element) => {
|
||||
if (
|
||||
isInitializedImageElement(element) &&
|
||||
filesMap.has(element.fileId)
|
||||
) {
|
||||
this.imageCache.delete(element.fileId);
|
||||
invalidateShapeForElement(element);
|
||||
bumpVersion(element);
|
||||
}
|
||||
});
|
||||
this.scene.informMutation();
|
||||
|
||||
this.addNewImagesToImageCache();
|
||||
},
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user