Data no loading when refreshing the page
Hello! I have a small problem that is really bugging me. I use pinia to store all the data imported from DIrectus.
In my components I simply have this:
import { useItemStore } from '@/stores/items';
const itemStore = useItemStore()
const items = ref(itemStore.getItems)
then, I iterate through the items with a v-for to render all my items. Straight forward and classic I think.
It works fine but if I refresh the page, then it doesn't render and nothing appears on the page. Then if I navigate to another page and I come back, it works just fine and all items are shown.
I thaught that because refs are reactive, the DOM is supposed to update whenever the ref is updated. Am I wrong? And I'm not quite sure if I need to use refs or not...
I probably miss a small detail, but I can't figure it out.
Anyone knows the solution to this problem?
In my components I simply have this:
import { useItemStore } from '@/stores/items';
const itemStore = useItemStore()
const items = ref(itemStore.getItems)
then, I iterate through the items with a v-for to render all my items. Straight forward and classic I think.
It works fine but if I refresh the page, then it doesn't render and nothing appears on the page. Then if I navigate to another page and I come back, it works just fine and all items are shown.
I thaught that because refs are reactive, the DOM is supposed to update whenever the ref is updated. Am I wrong? And I'm not quite sure if I need to use refs or not...
I probably miss a small detail, but I can't figure it out.
Anyone knows the solution to this problem?