Closed rmpowell77 closed 3 years ago
I have a newfound love for this review feature:
Notes from Richard:
Need to look for any changes to the store that are outside of the mutations. For example, in our continuity editor UI:
const continuity: ContEven = this.$store.getters.getContinuity(
this.dotTypeIndex,
this.continuityIndex
);
continuity.marchType = marchType;
this.$store.commit("updateDotTypeContinuity", {
dotTypeIndex: this.dotTypeIndex,
continuityIndex: this.continuityIndex,
continuity,
});
Additionally, mutations should not accept references as parameters. This is because it makes it difficult to have undos/redos if the original state gets modified. It should only accept primitives, or at the very least, not a reference to data in the current state.
Testing? Whatever gets you unblocked the fastest.
Adding an undo/redo system.
Description
This closely follows the outline by Anthony Gore: https://vuejsdevelopers.com/2017/11/13/vue-js-vuex-undo-redo/
What we do is we have the undo system implemented as a stack of Store Commit changes. When we do an undo, we go back to an initial state and redo all of the Store commit commands. With CalChart, not every Store commit is a change we want to undo, so we have a filter where we only save certain commits.
Using this change to also clean up several things to make thing easier:
Have not done the unit tests yet.
Pre-PR checklist
npm run serve
and:npm run lint
npm run test:unit
npm run test:e2e
and ran relevant testsScreenshots/GIFs
[Attach screenshots if making a visible change!]