From b38f03c0e7218762d90fa5092696b127f24f36db Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 25 Jan 2026 07:07:26 +0000
Subject: [PATCH] =Some logical flaws in Queue.php, Queue.js, ContentExecutor.php, UploadExecutor.php - particularly with timeline ordering, frontend queue updates, etc

---
 inc/blocks/FormBlock.php |   24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/inc/blocks/FormBlock.php b/inc/blocks/FormBlock.php
index fd5fe29..3e8a892 100644
--- a/inc/blocks/FormBlock.php
+++ b/inc/blocks/FormBlock.php
@@ -1,7 +1,7 @@
 <?php
 namespace JVBase\blocks;
 
-use JVBase\managers\CacheManager;
+use JVBase\managers\Cache;
 use JVBase\meta\MetaManager;
 use JVBase\managers\CloudflareTurnstile;
 use Exception;
@@ -19,8 +19,8 @@
  */
 class FormBlock
 {
-	protected static FormBlock|null $instance = null;
-	protected CacheManager $cache;
+	protected static ?FormBlock $instance = null;
+	protected Cache $cache;
 	protected array $forms;
 	protected string $form_contact;
 
@@ -36,7 +36,7 @@
 
 	public function __construct()
 	{
-		$this->cache = CacheManager::for('form_blocks', WEEK_IN_SECONDS);
+		$this->cache = Cache::for('forms', WEEK_IN_SECONDS);
 		// Initialize forms from filter
 		$this->forms = $this->registerForms();
 		$this->form_contact = apply_filters('jvb_form_contact', '');
@@ -131,16 +131,12 @@
 		}
 
 		$cache_key = $this->cache->generateKey($block);
-		$cached = $this->cache->get($cache_key);
-		$cached = false;
-		if ($cached) {
-			return $cached;
-		}
-
-		$rendered = $this->renderForm($form_type, $block);
-
-		$this->cache->set($cache_key, $rendered);
-		return $rendered;
+		return $this->cache->remember(
+			$cache_key,
+			function() use ($form_type, $block) {
+				return $this->renderForm($form_type, $block);
+			}
+		);
 	}
 
 	/**

--
Gitblit v1.10.0