I am getting behavior in Nuxt.js I do not understand.
In a component I am successfully fetching data to
this.myData and working with it in a computed property
this.myComputedData. But when the component is updated in development, let’s say because I added a console.log statement,
this.myComputedData is empty again and I get this error »TypeError: Cannot read properties of undefined«.
It seems that
async fetch () is called again when the component updates, with is okay. But the weird thing I do not understand is why
this.myData is reset, as if fetch wasn’t called before and the data wasn’t populated.
I currently ether write the data to a vex store where it stays populated (but this is not always wanted and/or possible) or fallback to fallback data
this.myComputedData, which does not look nice because the content disappears for a moment.
Does anybody have a better solution or ideas why this happens?