mirror of
				https://github.com/excalidraw/excalidraw.git
				synced 2025-11-04 12:54:23 +01:00 
			
		
		
		
	Fix three rendering when loading (#986)
The problem is that syncActionResult wasn't using batching.
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							e9f5175f51
						
					
				
				
					commit
					0dc07135b7
				
			@@ -186,31 +186,30 @@ export class App extends React.Component<any, AppState> {
 | 
			
		||||
    this.actionManager.registerAction(createRedoAction(history));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private syncActionResult = (
 | 
			
		||||
    res: ActionResult,
 | 
			
		||||
    commitToHistory: boolean = true,
 | 
			
		||||
  ) => {
 | 
			
		||||
    if (this.unmounted) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
    if (res.elements) {
 | 
			
		||||
      globalSceneState.replaceAllElements(res.elements);
 | 
			
		||||
      if (commitToHistory) {
 | 
			
		||||
        history.resumeRecording();
 | 
			
		||||
  private syncActionResult = withBatchedUpdates(
 | 
			
		||||
    (res: ActionResult, commitToHistory: boolean = true) => {
 | 
			
		||||
      if (this.unmounted) {
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
      if (res.elements) {
 | 
			
		||||
        globalSceneState.replaceAllElements(res.elements);
 | 
			
		||||
        if (commitToHistory) {
 | 
			
		||||
          history.resumeRecording();
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (res.appState) {
 | 
			
		||||
      if (commitToHistory) {
 | 
			
		||||
        history.resumeRecording();
 | 
			
		||||
      if (res.appState) {
 | 
			
		||||
        if (commitToHistory) {
 | 
			
		||||
          history.resumeRecording();
 | 
			
		||||
        }
 | 
			
		||||
        this.setState(state => ({
 | 
			
		||||
          ...res.appState,
 | 
			
		||||
          isCollaborating: state.isCollaborating,
 | 
			
		||||
          collaborators: state.collaborators,
 | 
			
		||||
        }));
 | 
			
		||||
      }
 | 
			
		||||
      this.setState(state => ({
 | 
			
		||||
        ...res.appState,
 | 
			
		||||
        isCollaborating: state.isCollaborating,
 | 
			
		||||
        collaborators: state.collaborators,
 | 
			
		||||
      }));
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
    },
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  private onCut = withBatchedUpdates((event: ClipboardEvent) => {
 | 
			
		||||
    if (isWritableElement(event.target)) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user