Refresh templates after a deploy


#1

I’m fairly new to Ember and haven’t found a good solution for this. What approach is typically used to get the latest hbs template after a deploy? Here is a simple example of what I am trying to accomplish:

  • My application has a left side menu. I remove a link in the left nav commit my code and deploy it to my server.

  • I navigate to another page or logout/login. The old template is still rendered and still shows the link I just removed in the left nav. If I do a browser refresh I get the new page

  • I want the new template to render if the user navigates to another screen without requiring the user to refresh the browser

I’m thinking about keeping an application version server side in the API and any time I deploy, it will update the application version and send that over as a part of the API response. The first time the user loads the app, it will store the app version client side if it doesn’t already exist. Each API response will contain the current version number and I will have code that checks API responses to see if the app version stored client side matches the current application version from the API response. If they don’t match, it will update the app version on the client side and then reload the templates to make sure the latest version of the template is rendered.

Is there a better approach than this?

How do I force the templates to refresh in the ember code? Is the only option to do window.location.reload(true) or is there something built into Ember than can accomplish the same thing?

Thanks!


#2

Perhaps you can use this addons: