Page 1 of 1

How to selectively prevent caching?

Posted: Sun Jan 05, 2014 5:30 am
by Tom Mccann

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?


How to selectively prevent caching?

Posted: Sun Jan 05, 2014 5:45 am
by maxkatz

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


How to selectively prevent caching?

Posted: Sun Jan 05, 2014 6:04 am
by Tom Mccann

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.


How to selectively prevent caching?

Posted: Sun Jan 05, 2014 6:08 am
by maxkatz

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.


How to selectively prevent caching?

Posted: Mon Jun 02, 2014 5:21 am
by Himanshu

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


How to selectively prevent caching?

Posted: Mon Jun 02, 2014 5:38 am
by Evgene Karachevtsev

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.