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

Share with
Tags
Latest Comments
By Mark Gentry on Windows Server 2019 - Change product key does nothing
20 Aug 2021, 03:30 AM
By Cathy on In-Place Upgrade for a Windows Server domain controller
31 Jul 2021, 18:28 PM
By Mr. Greymatter on Raspberry Pi - Running Java app on Raspbian
16 Feb 2021, 07:35 AM
By Mikko Seittenranta on Xamarin Forms multiple instances of same app open
16 Feb 2021, 04:34 AM
By Andrew on Auto/Custom height on Xamarin Forms WebView for Android and iOS
22 Jan 2021, 22:15 PM
By Nick on Raspberry Pi - Running Java app on Raspbian
14 Oct 2020, 19:37 PM
By Ivan on Fixed: Value cannot be null Parameter Name: source
15 Sep 2020, 19:47 PM
By Anand on Raspberry Pi - Bluetooth using Bluecove on Raspbian
7 Sep 2020, 16:53 PM
Categories
App Development
Event
Game Development
Mapping
Modelling
Programming
Review
Robotics
Tutorial
Web Development