Skip to content

Commit

Permalink
fix(history): fixed command order for undo
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewcourtice committed Aug 11, 2021
1 parent de61226 commit c08415c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion extensions/history/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@ export default function historyExtension<TState extends BaseState>(options?: Par
store.write('$history', SENDER, state => {
const tasks = COMMAND_MAP[type];

const {
let {
results,
} = command;

if (type === 'undo') {
results = results.slice().reverse();
}

results.forEach(({ gate, nodes, prop, newValue, oldValue }) => {
const target = fromPath(state, nodes);

Expand Down

0 comments on commit c08415c

Please sign in to comment.