Umbraco package/datatype JS not updating on live site

So you've created a package or a custom data type and it's going pretty well, you publish your changes and that works too. But then you make a change to the js and this time it hasn't updated, console logs aren't coming through and everything you try just doesn't seem to get the updates to work on the live site. What's wrong? The good news is, it's a simple fix.

The full story:

As it turns out, your changes will work locally because your local environment is running in debug mode, put the moment you publish, they stop working on the live site, what's up?

We have to look at what's different between the two website instances and looking at the browser console in Chrome, we'll quickly see that the debug site loads all the files in as expected, but the live site uses Client Dependency and loads everything through the DependencyHandler.axd file with a HUGE query string on the end, this is where our problem lies.

Umbraco uses client dependency to combine, compress and minify all of the files that it requires to run the back office; it does this to speed up loading times by reducing file size and connection/response times. It doesn't stop there though, Umbraco will cache these files for future use which is pretty cool because it'll make things even quicker than they already are, but there's one downside to this and that's the problem we're having now.

We updated our file which worked fine first time, but now it doesn't seem to wan to update and this as we've found out is down to Client Dependency, it's cached an old copy of our files and we need it to update. We could delete the files from the ClientDependency folder under the App_Data folder and then touch the web config to force the application to restart, but this doesn't always work, what do we do? ClientDependency has a config file and it's going to save the day.

The solution:

I apologise for the lengthy back story, the solution is a simple one.

Open the Config folder within your project, open the ClientDependency.config file and look for the root node within the file, there's an attribute on the root ClientDependency element (it's an XML file) called version, simply increment the number stored in its value by 1 or more and publish the file to production. 

Example:

<clientDependency version="2" fileDependencyExtensions=".js,.css" loggerType="Umbraco.Web.UI.CdfLogger, umbraco">
...
</clientDependency>

                        

Published at

Tags: Umbraco,Angular JS,Datatype

Luke Alderton

Comments

Post a comment
Sit tight...
We're adding your comment.
Thank you.
Your comment has been added.
There's been a problem.
Please try again later.
Share with
Tags
Latest Comments
By PS on Replacing the Xamarin Header/Navigation bar with a custom view/template
16 Apr 2018, 07:53 AM
By Srusti Thakkar on How to add a Xamarin Forms Loading Screen/Overlay
27 Mar 2018, 18:22 PM
By Luke on How to add a Xamarin Forms Loading Screen/Overlay
23 Mar 2018, 15:03 PM
By Srusti Thakkar on How to add a Xamarin Forms Loading Screen/Overlay
23 Mar 2018, 13:16 PM
By Marco Teodoro on Custom section tree nodes and routes - Umbraco
21 Mar 2018, 11:08 AM
By ttt asd on Limit Google Autocomplete results to country and city
20 Mar 2018, 11:53 AM
By hamid on Limit Google Autocomplete results to country and city
19 Mar 2018, 21:13 PM
By matt on Auto/Custom height on Xamarin Forms WebView for Android and iOS
17 Mar 2018, 02:18 AM
Categories
App Development
Event
Game Development
Mapping
Modelling
Programming
Review
Robotics
Tutorial
Web Development