Jake Vanderwerf
3 hours ago 56a9a1ccf764ff7a6af8f8a2292cb07443cb4aa7
assets/js/concise/TaxonomySelector.js
@@ -1135,11 +1135,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() {