Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70850

Issue with reactivity in Vue with Pinia and router caching pages

$
0
0

It can be the dumbest question, but I think not.

Lets imagine you have an app that has a login, donwloads some data and then you can log out.
Lets imagine you have 2 pages. So you step on all of them and you get both pages loaded in the dom, one of them with ion-page-hidden. There you have a variable acessing some data that you know does exists because you did a login. The thing is that, when you are in the second page, you wipe some information, let’s say you do a logout. Then, as in the dom the first page is still loaded, and I assume reactivity is still “running”, there is an error on the first page because data can not be accessed.
That’s not how it is supposed to work in a regular webapp, because the complaining dom is not loaded and you don’t even want it to be.

I’ve read why is it done, but the question is how am I supposed to avoid this issue.
A v-if in the complaining page does not seem to do the job, either.

How to reproduce:
git clone [text](https://github.com/Pijuli/ionic-vue-pinia-fail)
npm ci
npm run serve

go to localhost:8080
Open navigator console
Navigate to the other page with the button
Wipe the data

What to expect:
See console complains

Again, this might be dumb, but I’m not seeing how to proceed with it.
Thank you <3

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 70850

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>