Tom Mccann
Posts: 0
Joined: Sun Nov 03, 2013 8:11 am

How to selectively prevent caching?

I recently changed to the multi-page template because I wanted caching on some pages. That works well.

However, I have a list. Clicking on the list navigates to a form page to display a database record. The form loads the database record via a rest service. That works ok the first time I open a record (lets call it record 'A'). The problem occurs when I click on another list item (e.g. item 'B'). It opens the form page with record 'A' still displayed. It is obviously caching page 'A'.

What I'd really like to do is prevent caching in this instance. In other words, the navigateto should open the form and invoke a new load event - to trigger the rest service.

I know I could use the 'show page' event. I tried this. The problem is that the page loads with the cached record 'A', then quickly updates with the correct record 'B'. The user sees the wrong contents for a brief moment. It's not a good look.

Is there any way I can use the navigateto command but somehow tell it to perform a normal page load? i.e. to prevent caching?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to selectively prevent caching?

On what event do you invoke the service on the details page?

Tom Mccann
Posts: 0
Joined: Sun Nov 03, 2013 8:11 am

How to selectively prevent caching?

On the Load event. On the list page, I set a localStorage variable with the id of the record. Then the rest service maps that to the ObjectId. Pretty standard technique.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to selectively prevent caching?

Load event is fired only once, when the page is loaded into the browser (DOM). It's not fired when you navigate to the page the second time. Use page show event instead.

Himanshu
Posts: 0
Joined: Mon Mar 31, 2014 9:46 am

How to selectively prevent caching?

Max, Please check this question.
Load event fires on multiple times. Please give me any guidance on it.
https://getsatisfaction.com/apperyio/...

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

How to selectively prevent caching?

Hello Himashu,

Please clarify, have you tried what was suggested here https://getsatisfaction.com/apperyio/...

Let's continue within one post, if you don't mind.

Return to “Issues”