fix: don't bump element version when adding files data (#4794)

* fix: don't bump element version when adding files data

* fix lint
This commit is contained in:
David Luzar 2022-02-16 13:56:36 +01:00 committed by GitHub
parent b2767924de
commit 5c61613a2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,11 +115,7 @@ import {
updateBoundElements, updateBoundElements,
} from "../element/binding"; } from "../element/binding";
import { LinearElementEditor } from "../element/linearElementEditor"; import { LinearElementEditor } from "../element/linearElementEditor";
import { import { mutateElement, newElementWith } from "../element/mutateElement";
bumpVersion,
mutateElement,
newElementWith,
} from "../element/mutateElement";
import { deepCopyElement, newFreeDrawElement } from "../element/newElement"; import { deepCopyElement, newFreeDrawElement } from "../element/newElement";
import { import {
hasBoundTextElement, hasBoundTextElement,
@ -1620,9 +1616,6 @@ class App extends React.Component<AppProps, AppState> {
this.files = { ...this.files, ...Object.fromEntries(filesMap) }; this.files = { ...this.files, ...Object.fromEntries(filesMap) };
// bump versions for elements that reference added files so that
// we/host apps can detect the change, and invalidate the image & shape
// cache
this.scene.getElements().forEach((element) => { this.scene.getElements().forEach((element) => {
if ( if (
isInitializedImageElement(element) && isInitializedImageElement(element) &&
@ -1630,7 +1623,6 @@ class App extends React.Component<AppProps, AppState> {
) { ) {
this.imageCache.delete(element.fileId); this.imageCache.delete(element.fileId);
invalidateShapeForElement(element); invalidateShapeForElement(element);
bumpVersion(element);
} }
}); });
this.scene.informMutation(); this.scene.informMutation();