josephwegner / makehex

GNU General Public License v3.0
3 stars 0 forks source link

Clean up store grid duplication #53

Open josephwegner opened 5 years ago

josephwegner commented 5 years ago

Previously grid were put into the vuex store as arrays - this was troublesome for a few reasons, but one of the remaining debts from this is that nearly all grid modifications use Object.assign({}, grid, changes) to instantiate a fresh grid object. This was necessary when using arrays, as Vue cannot react to property addition or deletion, nor changes to objects inside arrays.

Now that we are using a proper matrix inside of the store, we don't need to worry about this. Each coordinate object is converted to a getter/setter during state transitions - the only time we need to worry is when we add new rows/columns, which generates new qs and rs. We can likely use Vue.set in those cases.