0👍
✅
The issue you are having is that Vue cannot detect state changes when you directly try to set an array index like you are doing with state.device[index] = device
.
For this they provide Vue.set which allows you to update an array at a certain index. It is used like this:
//Vue.set(array, indexOfItem, newValue)
index === -1 ? state.device.push(device) : Vue.set(state.device, index, device);
You can read about it in the docs here
Source:stackexchange.com