From 7775a4ed6df2bb36f1d40ded2cf7da17acc65de8 Mon Sep 17 00:00:00 2001 From: Mischa Date: Sun, 5 Jul 2026 23:42:11 +0200 Subject: [PATCH] fix(cache-on-save): invalidate page index on save so new entries are editable deleteAll() only clears the Doctrine store; the page-tree index is keyed on md5(dirs + folderHash + config->checksum() + lang) (Pages::buildRegularPages). With cache.check.method:folder a freshly-created entry could survive in that index and stay invisible to GET /api/v1/pages{route} (404), so opening a just-posted entry for editing showed "this entry no longer exists" ~2/3 of the time. Add Cache::invalidateCache() (touches system.yaml -> bumps config checksum) so the index key changes and the tree rebuilds next request. Chosen over clearCache('standard'), which would nuke compiled Twig + assets on every post. Fixes the create->edit round-trip (Playwright ES1) and the DEL1 flake. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Mpdu3Dt1iVoozHwAMyjrbn --- plugins/cache-on-save/cache-on-save.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/cache-on-save/cache-on-save.php b/plugins/cache-on-save/cache-on-save.php index 6756326..1fa6f4e 100644 --- a/plugins/cache-on-save/cache-on-save.php +++ b/plugins/cache-on-save/cache-on-save.php @@ -1,6 +1,7 @@ checksum() + lang) (Pages::buildRegularPages). + // With cache.check.method:folder that index can survive a create — a fresh + // entry then stays invisible to the API (GET /api/v1/pages{route} 404s), so + // opening the just-posted entry for editing shows "this entry no longer + // exists". invalidateCache() touches system.yaml, bumping config->checksum() + // so the index key changes and the tree rebuilds on the next request. $this->grav['cache']->deleteAll(); + Cache::invalidateCache(); } /**