Review fixes

This commit is contained in:
Marcel Mraz 2025-04-30 13:51:30 +02:00
parent e8898b4429
commit df79ceae4e
No known key found for this signature in database
GPG key ID: 4EBD6E62DC830CD2
4 changed files with 3 additions and 7 deletions

View file

@ -529,11 +529,11 @@ export class StoreDelta {
delta: StoreDelta, delta: StoreDelta,
elements: SceneElementsMap, elements: SceneElementsMap,
appState: AppState, appState: AppState,
snapshot: StoreSnapshot = StoreSnapshot.empty(), prevSnapshot: StoreSnapshot = StoreSnapshot.empty(),
): [SceneElementsMap, AppState, boolean] { ): [SceneElementsMap, AppState, boolean] {
const [nextElements, elementsContainVisibleChange] = delta.elements.applyTo( const [nextElements, elementsContainVisibleChange] = delta.elements.applyTo(
elements, elements,
snapshot.elements, prevSnapshot.elements,
); );
const [nextAppState, appStateContainsVisibleChange] = const [nextAppState, appStateContainsVisibleChange] =

View file

@ -778,7 +778,6 @@ class App extends React.Component<AppProps, AppState> {
addFiles: this.addFiles, addFiles: this.addFiles,
resetScene: this.resetScene, resetScene: this.resetScene,
getSceneElementsIncludingDeleted: this.getSceneElementsIncludingDeleted, getSceneElementsIncludingDeleted: this.getSceneElementsIncludingDeleted,
store: this.store,
history: { history: {
clear: this.resetHistory, clear: this.resetHistory,
}, },

View file

@ -106,7 +106,6 @@ export class History {
// iterate through the history entries in case they result in no visible changes // iterate through the history entries in case they result in no visible changes
while (historyEntry) { while (historyEntry) {
try { try {
// creating iteration-scoped variables, so that we can use them in the unstable_scheduleCallback
[nextElements, nextAppState, containsVisibleChange] = [nextElements, nextAppState, containsVisibleChange] =
StoreDelta.applyTo( StoreDelta.applyTo(
historyEntry, historyEntry,
@ -120,8 +119,7 @@ export class History {
CaptureUpdateAction.IMMEDIATELY, CaptureUpdateAction.IMMEDIATELY,
nextElements, nextElements,
nextAppState, nextAppState,
// create a new instance of the history entry, so that it's not mutated in the meantime historyEntry,
HistoryEntry.restore(historyEntry),
); );
} finally { } finally {
// make sure to always push, even if the delta is corrupted // make sure to always push, even if the delta is corrupted

View file

@ -800,7 +800,6 @@ export interface ExcalidrawImperativeAPI {
history: { history: {
clear: InstanceType<typeof App>["resetHistory"]; clear: InstanceType<typeof App>["resetHistory"];
}; };
store: InstanceType<typeof App>["store"];
getSceneElements: InstanceType<typeof App>["getSceneElements"]; getSceneElements: InstanceType<typeof App>["getSceneElements"];
getAppState: () => InstanceType<typeof App>["state"]; getAppState: () => InstanceType<typeof App>["state"];
getFiles: () => InstanceType<typeof App>["files"]; getFiles: () => InstanceType<typeof App>["files"];