@@ -18,6 +18,7 @@ import { receiveItems, removeItems, receiveQueriedItems } from './queried-data';
18
18
import { getOrLoadEntitiesConfig , DEFAULT_ENTITY_KEY } from './entities' ;
19
19
import { createBatch } from './batch' ;
20
20
import { STORE_NAME } from './name' ;
21
+ import { getUndoEdits , getRedoEdits } from './private-selectors' ;
21
22
22
23
/**
23
24
* Returns an action object used in signalling that authors have been received.
@@ -406,14 +407,14 @@ export const editEntityRecord =
406
407
export const undo =
407
408
( ) =>
408
409
( { select, dispatch } ) => {
409
- const undoEdit = select . getUndoEdit ( ) ;
410
+ // Todo: we shouldn't have to pass "root" here.
411
+ const undoEdit = select ( ( state ) => getUndoEdits ( state . root ) ) ;
410
412
if ( ! undoEdit ) {
411
413
return ;
412
414
}
413
415
dispatch ( {
414
- type : 'EDIT_ENTITY_RECORD' ,
415
- ...undoEdit ,
416
- meta : { isUndo : true } ,
416
+ type : 'UNDO' ,
417
+ stackedEdits : undoEdit ,
417
418
} ) ;
418
419
} ;
419
420
@@ -424,14 +425,14 @@ export const undo =
424
425
export const redo =
425
426
( ) =>
426
427
( { select, dispatch } ) => {
427
- const redoEdit = select . getRedoEdit ( ) ;
428
+ // Todo: we shouldn't have to pass "root" here.
429
+ const redoEdit = select ( ( state ) => getRedoEdits ( state . root ) ) ;
428
430
if ( ! redoEdit ) {
429
431
return ;
430
432
}
431
433
dispatch ( {
432
- type : 'EDIT_ENTITY_RECORD' ,
433
- ...redoEdit ,
434
- meta : { isRedo : true } ,
434
+ type : 'REDO' ,
435
+ stackedEdits : redoEdit ,
435
436
} ) ;
436
437
} ;
437
438
0 commit comments