Template/theme cache

I often encounter a problem where, when changing the theme for a specific page, the modules cache the previous one. I implement brand refreshment using a child theme in order to keep the current modules, content, etc., but after changing the theme/template, the modules still point to the previous theme, which can be seen in debug mode. This happens both in content staging and outside of it. Is there any way to fix this?

Hey @kgwozdz - thanks so much for posting in the Community!
I’d like to tag in some experts here to see if they have any insight! @Bortami, @jeremymandle, and @eburnaman - any thoughts here?
Shane, Senior Community Moderator

Hi @kgwozdz,

When you switch a template/theme on an existing page, the modules will always remain as their original instance. Meaning, they won’t automatically convert to the new theme, even if an identical module is present in that theme.

One approach is to manually add the modules from your new theme and re-populate the content, then delete the original module.

Another option would be to see if you could utilize the CMS API. There is an endpoint to retrieve the contents of a page. If the page setup is simple enough, you could potentially just swap out the module IDs and try to to make edits to your page with the page update endpoint. Obviously try with a cloned page first to see what the results would be, potentially recalibrate and try a few more times to see if this option would work for you.

There might be other options that I have missed but this is what comes to mind.

Hope this helps!