[Offline Apps] How to invalidate cache manually on event?

[Offline Apps] How to invalidate cache manually on event?

  
Forge Component
(25)
Published on 2015-11-19 by OutSystems Labs
25 votes
Published on 2015-11-19 by OutSystems Labs

Hi,

I have an app with external link to user's profile page that has session.userid as a parameter "profilepage.aspx#UserId="+Session.UserId 

I use offline form and all works fine except that if I logout and religion with another user this link still has previous user id so on page i see another user info not currently logged in.

Should I generate link differently or invalidate cache on logout?

Thank you


Solution

Hey, Mykola,

What's happening is the page is being cached on the device with the link's value hardcoded (it's probably from the user for the manifest build), instead of a placeholder that would be replaced during Offline's render.

What I suggest is either using your own token for the user ID and then use the finishRender event again to replace it by a JS variable's value; or simply create a new entity to sync the user ID value to local storage (you can use this entity to store other session variable values you may want).

Would any of these approaches do for you? Unfortunately, Offline Apps assumes any dynamic data in the page comes sync'ed records, so session variables are out of the table, too.

Please let us know how it went.

Best regards,

Carlos Simões

Solution

Hi Carlos, I've tried your suggestion to replace link value with JS ob finishRender event and  it worked perfectly. Thanks