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..
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.
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
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.
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.
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..
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?
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.
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 ;')
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
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.
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.
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.
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:
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.
I have the same problem. So I decided to make my plugin development on localhost. Then its working fine.
@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?
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 !
is working on a reply...