1๐
You probably need to set an empty array ([]
) as an initial value to state.data.rides
instead of null
.
Another option will be to check that rides
is truthy in your getters.
Something like:
if (rides) {
rides.sort(( a, b) => {
return new Date(a.date) - new Date(b.date);
});
}
return []
0๐
I was able to resolve my problem and it turns out I made a mistake. I completely forgot I set state.data.rides = null
instead of an empty array state.data.rides = null
, which would explain why the array was empty. It was a legacy code I had ๐
- [Vuejs]-Uncaught TypeError: Vue.mixin is not a function
- [Vuejs]-Continuation of the function after calling setInterval
Source:stackexchange.com