Copied to clipboard

Flag this post as spam?

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


  • Ambert van Unen 175 posts 819 karma points c-trib
    Jan 02, 2020 @ 08:52
    Ambert van Unen
    0

    Plugin cache

    Hi,

    I've been struggling with this for a while now. I've written a small plugin that a user can select a picker to be shown in the grid. The picker (when loaded), loads a .cshtml file in App_Plugins/Modulename/modulename.cshtml

    These file is horrible cached. I've tried removing the

    /cache,

    /temp

    /models

    folder on my test enviroment, and regenerated the memory and database caches. But still it keeps loading the old .cshtml file for this plugin. I'm currently out of options. I've quadruple checked that the correct files are present, but still it loads the old ones..

    It almost feels like its cached in the database somewhere..

    Any ideas?

  • Thomas Rydeen Skyldahl 47 posts 229 karma points
    Jan 02, 2020 @ 09:01
    Thomas Rydeen Skyldahl
    0

    Try incrementing the /config/clientDependency.config -> version attribute on the root element in the file.

    You can also try deleting the 'Temporary ASP.NET Files' inside 'C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files' and 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files' this forces IIS/IIS Express to recompile the cshtml files in the project.

  • Ambert van Unen 175 posts 819 karma points c-trib
    Jan 02, 2020 @ 09:25
    Ambert van Unen
    0

    Stopped IIS,

    upped the clientDependency attribute

    Deleted all files in Framework/V4/Temp and Framework64/V4/Temp

    Deleted all files in appdata/cache and appdata/temp

    Started IIS, Opened in new browser, same result .. :-)

    I've done the .js changes over a 1,5 month ago already. Still hasn't updated. Only locally the changes can be seen, not on my testserver.

    Could it be that it is stored somewhere in the DB because its's beeing inserted into the Grid? Sounds odd.. But running a bit out of options ;')

  • Thomas Rydeen Skyldahl 47 posts 229 karma points
    Jan 02, 2020 @ 10:17
    Thomas Rydeen Skyldahl
    0

    Normally js and cshtml files are not cached in the database, the only place I know this happens are for templates, where the source is also kept in DB, as I remember it here the preference is to use the file if it exists.

    What happens in Incognito mode, take note of the scripts loaded in the browser 'Dev Tools' is the old script loaded here? note that the ?cdv= should match the version from ClientDependency.config

  • Ambert van Unen 175 posts 819 karma points c-trib
    Jan 02, 2020 @ 10:26
    Ambert van Unen
    0

    My mistake, I stated something unclear. Its not the js file itself. I have some javascript inside the .cshtml, which is cached together with the code ofcourse.

    So basically, it's just the .cshtml file that is cached indefinitly for some reason.

    I'll adjust the main post.

  • Thomas Rydeen Skyldahl 47 posts 229 karma points
    Jan 02, 2020 @ 15:06
    Thomas Rydeen Skyldahl
    0

    Is the plugin implemented as a macro or a property editor?

    https://our.umbraco.com/documentation/Tutorials/creating-a-property-editor/#setting-up-a-plugin.

    My guess is that macros could snapshot the html output from the cshtml into the grid, then the only way to update it is to delete the existing element in the grid and create a new element, after updates.

    But I haven't used macros in a long time, I tend to stick to grid editors, nested content or custom property editors instead.

  • Ambert van Unen 175 posts 819 karma points c-trib
    Jan 03, 2020 @ 13:21
    Ambert van Unen
    0

    Hi Thomas,

    thanks for your replies so far. I've implemented it as a property editor, it's being added to the grid which is loaded by a partial view, not a macro.

    enter image description here

  • Thomas Rydeen Skyldahl 47 posts 229 karma points
    Jan 03, 2020 @ 13:41
    Thomas Rydeen Skyldahl
    0

    wouldn't it then be possible for you to move the inline script into your controller?

    and have a $scope.magicFunction = function() { };

    https://docs.angularjs.org/guide/scope

    I don't use any .cshtml files in the editor, just js, css and html, Here is a example of a package.manifest from one of my property editors:

    {
      "propertyEditors": [
        {
          "alias": "Retus.ProductTags",
          "name": "Retus Product Tags",
          "icon": "icon-smiley-inverted",
          "group": "media",
          "editor": {
            "view": "~/App_Plugins/RetusProductTags/retus-product-tags.propertyeditor.html"
          }
        }
      ],
      "javascript": [
        "~/App_Plugins/RetusProductTags/js/retus-product-tags.filter.js",
        "~/App_Plugins/RetusProductTags/vendor/ng-tags-input.min.js",
        "~/App_Plugins/RetusProductTags/js/retus-product-tags.controller.js"
      ],
      "css": [
        "~/App_Plugins/RetusProductTags/vendor/ng-tags-input.min.css",
        "~/App_Plugins/RetusProductTags/css/retus-product-tags.css"
      ]
    }
    
  • Ambert van Unen 175 posts 819 karma points c-trib
    Jan 04, 2020 @ 12:27
    Ambert van Unen
    0

    Hi Thomas,

    sadly not, the general script is already included, and for each time the 'picker' is added to a grid, a small script is added aswell with settings.

  • Niels Henriksen 74 posts 277 karma points
    Jan 03, 2020 @ 14:17
    Niels Henriksen
    0

    I have the same problem. So I decided to make my plugin development on localhost. Then its working fine.

  • Ambert van Unen 175 posts 819 karma points c-trib
    Jan 04, 2020 @ 12:27
    Ambert van Unen
    0

    @Niels, Not sure what you mean? It works locally(for some odd reason), but not on my (online) test enviroment. Haven't pushed it live yet.

    I could try to set the test enviroment to debug mode.. Maybe that will trigger it?

  • Ambert van Unen 175 posts 819 karma points c-trib
    Jan 31, 2020 @ 07:26
    Ambert van Unen
    0

    Well after numerous attempts to find it, I found the issue..

    It seems that in the past I have renamed the picker. But on my testserver there were now two pickers with a different name, but with the same alias..

    You see where I'm going here I guess..

    Umbraco always took the first one it found, and ignored the other. So I could update the "new" one, but it was never loaded. With the code being 90% similar it seemed like a cache issue..

    Thanks for thinking along !

Please Sign in or register to post replies

Write your reply to:

Draft