From 8e474bf7fae66b5da6824b631cb1884a442638f7 Mon Sep 17 00:00:00 2001 From: indykoning <15870933+indykoning@users.noreply.github.com> Date: Wed, 2 Apr 2025 17:07:45 +0200 Subject: [PATCH] Update nocache map on response This improves compatibility with frameworks like Vue where Html gets replaced once it has booted --- src/StaticCaching/Cachers/FileCacher.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/StaticCaching/Cachers/FileCacher.php b/src/StaticCaching/Cachers/FileCacher.php index 0a0a594b81..adc666894e 100644 --- a/src/StaticCaching/Cachers/FileCacher.php +++ b/src/StaticCaching/Cachers/FileCacher.php @@ -224,6 +224,13 @@ public function getNocacheJs(): string }) .then((response) => response.json()) .then((data) => { + var els = document.getElementsByClassName('nocache'); + var map = {}; + for (var i = 0; i < els.length; i++) { + var section = els[i].getAttribute('data-nocache'); + map[section] = els[i]; + } + const regions = data.regions; for (var key in regions) { if (map[key]) map[key].outerHTML = regions[key];