From 58e8ae0759ccfa97c478ccae4e0778bdce70966f Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Thu, 22 Jan 2026 22:40:02 +0000
Subject: [PATCH] =DirectoryManager.php updates, some javascript tweaks for CRUD.js, and minor style changes
---
assets/js/concise/TaxonomyCreator.js | 29 ++++++++++++++++++++++++-----
1 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/assets/js/concise/TaxonomyCreator.js b/assets/js/concise/TaxonomyCreator.js
index 11281e3..4a5d595 100644
--- a/assets/js/concise/TaxonomyCreator.js
+++ b/assets/js/concise/TaxonomyCreator.js
@@ -55,7 +55,6 @@
if (this.ui.form) {
this.ui.form.addEventListener('change', (e) => {
- console.log('Creator form change, prevents default');
e.preventDefault();
e.stopPropagation();
});
@@ -120,12 +119,32 @@
* Handle successful term creation
*/
async handleSuccessfulCreation(term, data) {
- // Close create form
- this.ui.details.open = false;
+ // Add term to store immediately - don't wait for fetch
+ const fullTerm = {
+ id: term.id,
+ name: term.name,
+ path: term.path || term.name,
+ slug: term.slug || term.name.toLowerCase().replace(/\s+/g, '-'),
+ parent: data.parent || 0,
+ taxonomy: data.taxonomy,
+ count: 0,
+ hasChildren: false
+ };
- // Clear cache to ensure fresh data
+ // Add to store data immediately so addSelected can find it
+ this.selector.store.data.set(term.id, fullTerm);
+
+ // Close create form
+ if (this.ui.details) {
+ this.ui.details.open = false;
+ }
+
+ // Clear cache and refetch in background for accuracy
this.selector.store.clearCache();
- await this.selector.store.fetch();
+ // Don't await - let it happen async
+ this.selector.store.fetch().catch(err => {
+ console.warn('Background fetch after term creation failed:', err);
+ });
}
/**
--
Gitblit v1.10.0