Automattic / newspack-theme

A theme for Newspack.
https://newspack.com
GNU General Public License v2.0
305 stars 66 forks source link

Don't update option on every request #2303

Closed claudiulodro closed 5 months ago

claudiulodro commented 5 months ago

All Submissions:

Changes proposed in this Pull Request:

Fixes an issue I noticed while debugging something. The template check never succeeds, so the template cache is cleared on every page load and the template version option is updated on every page load. This is because the option value is the string "1" but the check does a strict compare with integer 1.

Screenshot 2024-05-22 at 8 58 59 PM

I have this as a hotfix because removing this helps performance and it's a tiny change.

How to test the changes in this Pull Request:

  1. Install Query Monitor. Go to any page. In the DB section filter on UPDATE and see the option is updated on every page load.
Screenshot 2024-05-22 at 9 42 40 PM
  1. Apply this patch. Refresh the page. See the option is not updated on every page load any more.

Other information: