From 4089ba01e0881c89a72332e13bc3a80b6bddec2a Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Mon, 29 Jun 2026 22:15:55 +0000
Subject: [PATCH] =DashboardManager overhaul. A bit easier to modify the output of pages. Still have to get the account pages to work as expected, as well as verify the integrations and others are working - but registrar/content pages work as expected. Also fixed up the table generation in CRUD.js and CRUDSkeleton.php

---
 assets/js/concise/TaxonomySelector.js |   30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/assets/js/concise/TaxonomySelector.js b/assets/js/concise/TaxonomySelector.js
index e61835f..ab0e598 100644
--- a/assets/js/concise/TaxonomySelector.js
+++ b/assets/js/concise/TaxonomySelector.js
@@ -408,6 +408,7 @@
 	}
 
 	handleFocus(e) {
+		if (!Object.hasOwn(e, 'target')) return;
 		if (!this.container.contains(e.target) && !e.target.closest('[data-type="selector"], [data-field-type="selector"]')) {
 			return;
 		}
@@ -426,6 +427,7 @@
 
 	//Hide autocomplete dropdown on blur
 	handleBlur(e) {
+		if (!Object.hasOwn(e, 'target')) return;
 		if (!this.container.contains(e.target) && !e.target.closest('[data-type="selector"], [data-field-type="selector"]')) {
 			return;
 		}
@@ -1135,11 +1137,31 @@
 
 	handleFetchError(error) {
 		const field = this.currentField();
-		const message = field
-			? `Failed to load ${field.plural}`
-			: 'Failed to load data';
+		this.setMessage(field, true, 'Something went wrong.', false);
 
-		this.setMessage(field,true, message, false);
+		const conf = this.container.open || field?.isFilter ? this.ui : field?.ui;
+		const p = conf?.message?.message;
+
+		if (p && !p.querySelector('.clear-cache-btn')) {
+			const btn = document.createElement('button');
+			btn.className = 'clear-cache-btn';
+			btn.type = 'button';
+			btn.textContent = 'Clear cache and try again';
+			btn.addEventListener('click', async () => {
+				btn.remove();
+				this.store.clearCache();
+				if (this.activeField && field) {
+					await this.store.setFilters({
+						taxonomy: field.taxonomy,
+						page: 1,
+						search: '',
+						parent: 0
+					});
+				}
+			});
+			p.appendChild(btn);
+		}
+
 		console.error('Store fetch error:', error);
 	}
 	async batchFetchTaxonomies() {

--
Gitblit v1.10.0