From bdf344f19158a980a99dcca7c82c6e34e84533c0 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 15 Sep 2026 03:05:03 +0000
Subject: [PATCH] =Found little glitch with auto-adding rewrite rules to taxonomy Registrar instances where we have the post type as the base in the url rewrite

---
 inc/blocks/SummaryBlock.php |   36 +++++++++++++++---------------------
 1 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/inc/blocks/SummaryBlock.php b/inc/blocks/SummaryBlock.php
index ecf01ac..47b2713 100644
--- a/inc/blocks/SummaryBlock.php
+++ b/inc/blocks/SummaryBlock.php
@@ -2,7 +2,6 @@
 namespace JVBase\blocks;
 
 use JVBase\managers\Cache;
-use JVBase\forms\TaxonomySelector;
 use WP_Block;
 
 if (!defined('ABSPATH')) {
@@ -25,12 +24,10 @@
 
     public function __construct()
     {
-        $this->cache = Cache::for('summary_block', WEEK_IN_SECONDS);
+        $this->cache = Cache::for('summary_block', 'post', WEEK_IN_SECONDS);
         add_action('init', [ $this, 'registerBlock' ]);
 		add_action('wp_enqueue_scripts', [$this, 'enqueueScripts']);
-		if (JVB_TESTING) {
-			$this->cache->flush();
-		}
+
     }
 
     public function registerBlock()
@@ -50,22 +47,19 @@
         return (is_tax()) ? 'tax' : 'content';
     }
 
-    protected function generateKey():string
-    {
-        $obj = get_queried_object();
-        return match (true) {
-            is_tax() => jvbNoBase($obj->taxonomy) . $obj->term_id,
-            is_a($obj, 'WP_Post_type') => jvbNoBase($obj->name),
-            is_a($obj, 'WP_User') => jvbUserRole($obj->ID),
-            default => jvbNoBase($obj->post_type) . $obj->ID,
-        };
-    }
-
     public function render(array $attributes, string $content, WP_Block $block)
     {
         $this->config = $this->getConfig();
-        $key = $this->generateKey();
-        $cache = $this->cache->get($key);
+
+		if (is_tax()) {
+			$this->cache = Cache::for('summary_tax', 'term', WEEK_IN_SECONDS);
+		} elseif (is_author()) {
+			$this->cache = Cache::for('summary_auth', 'user', WEEK_IN_SECONDS);
+		} else {
+			$this->cache = Cache::for('summary_post', 'post', WEEK_IN_SECONDS);
+		}
+
+        $cache = $this->cache->get(get_queried_object_id());
 
         if ($cache) {
             return $cache;
@@ -130,7 +124,7 @@
         ob_start();
         $this->renderBlock();
         $content = ob_get_clean();
-        $this->cache->set($key, $content);
+        $this->cache->set(get_queried_object_id(), $content);
         return $content;
     }
 
@@ -173,7 +167,7 @@
         }
 		$open = $this->isOpen ? ' open' : '';
         ?>
-        <details class="info"<?=$open?>>
+        <section><details class="info"<?=$open?>>
             <summary class="row x-btw"><?= $this->detailsTitle ?></summary>
             <?php
             foreach ($this->details as $key => $details) {
@@ -187,7 +181,7 @@
             <?php
             }
             ?>
-        </details>
+        </details></section>
         <?php
     }
 

--
Gitblit v1.10.0