Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • spyd 4 posts 75 karma points
    Jul 13, 2016 @ 10:36
    spyd
    0

    Changes in Plugins' js file not applied due to cache

    I have a custom plugin, it is in the App_Plugins folder. It is working.

    I am changing a couple of lines in the plugins controller.js file.

    I am reloading the page.

    Changes are not applied because i'm getting served an old, cached version of that controller.js file.

    This is so simple, yet so frustrating.

  • spyd 4 posts 75 karma points
    Jul 13, 2016 @ 11:06
    spyd
    1

    Answering my own question after a bit of searching:

    I managed to disable the cache caused by the client dependency by going to the /Config/ClientDependency.config and changing the line that said

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

    to

    <clientDependency version="99999999" fileDependencyExtensions="" loggerType="Umbraco.Web.UI.CdfLogger, umbraco">
    

    as you can see i changed the version number so cache will expire, and i removed the .js and .css extensions.

    That of course means js and css files wont get cached anymore.

    As a side note, you guys really need to make a much simpler solution than this hacky way i did.

    How about a simple, plain

    <add key="JUST_DISABLE_THE_DAMN_CACHE_YEA_ALL_OF_IT_CAUSE_I_JUST_LOST_4_HOURS_SEARCHING_ON_GOOGLE_AND_YOUR_FORUM_FOR_A_SOLUTION_OK_THANKS_BYE" value="true"/>
    

    or something like that?

    Not trying to offend anyone btw, but this did ruin my day at work. link.

  • Dave Woestenborghs 3203 posts 10702 karma points MVP 4x admin c-trib
    Jul 13, 2016 @ 11:55
    Dave Woestenborghs
    0

    If you have debug set to true on your compilation tag in the web.config the js and css files are not bundled and minified.

    That way you don't need to change the client dependency config all the time when you make a change.

    Just a hard refresh of your browser (which will clear the browser cache) is enough.

    Be sure to set it back to false when moving to production.

    Dave

  • spyd 4 posts 75 karma points
    Jul 13, 2016 @ 12:18
    spyd
    1

    If you have debug set to true on your compilation tag in the web.config the js and css files are not bundled and minified.

    That is not correct. I tried

    <add key="umbracoDebugMode" value="true" />
    

    also in my web.config

    <compilation defaultLanguage="c#" debug="true" batch="false" targetFramework="4.5">
    

    Recycled pool, did "Emtpy cache and Hard reload" on chrome with the parameter ?umbDebug=true, and i was still being served the cached files.

  • Dave Woestenborghs 3203 posts 10702 karma points MVP 4x admin c-trib
    Jul 13, 2016 @ 12:20
    Dave Woestenborghs
    0

    Strange,

    That works fine for me. Did you undo your changes to the clientdepedency config ?

    Dave

  • spyd 4 posts 75 karma points
    Jul 13, 2016 @ 12:32
    spyd
    0

    Excuse me but i can't understand your question; You asking if i undid the changes when?

    with

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

    i have problem, i always getting old cached js files.

    as soon as i increase the number and remove the extensions .js,.css and restart the application, i'm being served the current js files. Any small change is instantly updated as no cache system seems to interfere with the serving of files.

  • Dave Woestenborghs 3203 posts 10702 karma points MVP 4x admin c-trib
    Jul 13, 2016 @ 12:33
    Dave Woestenborghs
    0

    That is because you are disabling the cache of client side assets entirely. That is not recommended.

  • Sean 4 posts 74 karma points
    Jun 28, 2019 @ 20:03
    Sean
    0

    I'm responding to confirm that this is an issue for me as well. In multiple Umbraco applications that I manage.

  • Stherm 9 posts 79 karma points
    Jul 15, 2019 @ 19:38
    Stherm
    0

    To manage this problem, I've added a prebuild event that change the version number every time I build. And the same action is done with a ++ in my CI. This should get done directly in umbraco. When I deploy or rebuild, necessarely, the cache need to be refreshed, (I think).

Please Sign in or register to post replies

Write your reply to:

Draft