2

I have a strange problem with my JS-link files.

Scenario I have placed a list webpart on a wiki page. On this webpart I have set the JSLink property to a js-file in the Style Library: ~sitecollection/Style Library/Overview.JSLink.6.js The js-file is published and checked in.

I'm trying to update/develop a custom view using jslink.

No matter how hard I press refresh, hard-refresh, ctrl-f5, browser close/reopen, clear cache or what so ever, I always get the old-version.

Checking the source I see the following script tag being generated: <script src="/app/siteinfo/style%20library/Overview.jslink.6.js?ctag=0$$15.0.4551.1508" type="text/javascript"></script>

Notice the ctag being generated!

If i try to get the file using this URL (including ctag) I get the old version, using the same URL without the ctag I get the correct (new) version.

Why is the webpart generating an URL with ctag, thus forcing a specific version to be used on the page, instead of the most recent version of the file?

This makes developing annoying, the only way to force the page to use the new version is to use an other file name (and thus editing the js-link property).

Other specifics

  • Minimal Download Strategy is disabled
  • Blobcache is enabled
  • File is placed in style library

It is not the same problem as this question: JSLink - SP not updating code

edit The answer to this question (JS files returning Cached (Old) Versions Despite Update) was to place the js-link in the style library. I already tried that.

edit2 This seems to be the same problem JSLink (js)file is updated, but still can't see any changes, maybe caching? See the comments

2

I have not experienced this issue first hand but clearly it appears to be server side.

  1. Is there a load balancer / proxy in the mix? Is it being cached there?
  2. Do an IISReset across all servers.
  3. Try flushing the object cache on the site `_layouts/15/objectcachesettings.aspx
  4. Clear the configuration cache on all servers.
  5. Flush the blob cache

    $webApp = Get-SPWebApplication "<webapp url>"
    [Microsoft.SharePoint.Publishing.PublishingCache]::FlushBlobCache($webApp)
    
  6. Look at adding (d) tag to the end of your JSLInk file - SharePoint will use the script on demand (SOD) functionality to load in your file instead of directly on page load. I'm just throwing this one out there as something to try I'm not sure if will change the behavior or not.

As for your CTAG that should be updated when you update your file. That is specifically the reason it is there to avoid the caching issues you are seeing. So it could be that for some reason SharePoint is not 'registering' your file change.

I can't imaging this is something you have to do with each update. I've created JSLink files in the past (and edited them) and never encountered this issue. So hopefully it's just a one-time thing that goes away after your resolve this issue. If it is the Blob cache and it consistently is out of sync with your database you probably need to open a case with MS to track down the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.