Dynamic content is not loaded due to wrong page caching

I have an Ionic React (Capacitor) App where I have following problem:
When I navigate from my /vehicles page to /vehicle/1 (Shows specific vehicle with id=1) the correct vehicle gets displayed, but when I now click on my IonTabButton which redirects to /vehicles and I now navigate (I am using an IonCard for that) to /vehicle/2 → the content of /vehicle/1 is still displayed and the new content of vehicle with id=2 is not displayed.

Is there a way to deactivate the cache for my application so that this problem does not occur anymore?
Or can I clear the cache when I enter the /vehicles page?

My code:
/vehicles page:

<IonCard key="1" routerLink="/vehicle/1"></IonCard>
<IonCard key="2" routerLink="/vehicle/2"></IonCard>

In the /vehicle/1 page or /vehicle/2 page there is just some code which gets the id using PageProps and retrieves vehicle specific data using an REST API.

I am looking forward to your help!

1 Like