From c204185ae86a98994f80010abf35a190c9406739 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 12 Jul 2026 18:08:19 +0000
Subject: [PATCH] =Refactor of Integrations.php. Separated different functionality into traits that classes can use to add that functionality. Hopefully will make maintaining it a little easier. Still have to finish up, as well as refactoring the individual classes to utilize the new system.
---
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