Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flush cache after saving/creating/exporting themes #654

Merged
merged 2 commits into from
May 30, 2024

Conversation

matiasbenedetto
Copy link
Contributor

@matiasbenedetto matiasbenedetto commented May 29, 2024

What?

This pull request includes changes to flush the cache after creating new themes.

Fixes: #655

Why?

When the cache is not flushed, in plataforms using the WordPress cache utils, it could result in the editor loading a blank page.
This ensures that the cache is updated with the latest theme data.

How?

By calling wp_cache_flush(); after the creation of new themes and variations.

How to test.

  • Create a site in pressable.
  • Install and activate CBT plugin with this patch.
  • Make a change to a template text and save the changes in the editor.
  • Save the changes to the theme using the CBT sidebar 'Save theme changes' button.
  • Check that the changes were saved successfully and loaded in the editor as expected.

Copy link
Member

@mikachan mikachan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it's working well, good detective work 👏

I tested by making sure I could reproduce the error on a new Pressable site, and then with the changes in this PR I updated templates in both TT4 and TT3 via CBT. The editor reloaded correctly both times 🎉

@matiasbenedetto matiasbenedetto merged commit 4b1181d into trunk May 30, 2024
2 checks passed
@matiasbenedetto matiasbenedetto deleted the add/flush-cache-after-writing-filesystem branch May 30, 2024 09:20
@matiasbenedetto matiasbenedetto changed the title Flush cache after creating new themes Flush cache after saving/creating/exporting themes Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cache is preventing that edited themes render as expected
2 participants