[Solved] Prevent caching of macro in Richtext edit...
# help-with-umbraco
j
We have a macro in a richtext editor. Via this macro the editor can insert a code, and in the partial a specific script is then loaded, to insert personalised content. This is working fine, but due to the CSP policy, the script in the macro has a nonce. Unfortunately the content of the RTE is being cached, including the nonce. So it only works the first time after a publish, but when you refresh the page the script is blocked by the CSP rules. Is there a way to exlude either the nonce/script or the macro/RTE from the cache?
j
Yes, I tried them, but that doesn't seem to help. No matter what the settings are, it's still being cached.
h
You mention a partial, is that also maybe being cached?
j
We found the solution. In this project we use ViewComponents. And by not passing the CacheBuilder to the ViewModelFactory, we disabled the cache for this parent component. It looked like the parent component using the Macro was caching everything, so the macro caching settings were overridden.
11 Views