|
@@ -647,8 +647,7 @@ async function loadPatterns(forceRefresh = false) {
|
|
|
|
|
|
|
|
// First load basic patterns list for fast initial display
|
|
// First load basic patterns list for fast initial display
|
|
|
logMessage('Fetching basic patterns list from server', LOG_TYPE.DEBUG);
|
|
logMessage('Fetching basic patterns list from server', LOG_TYPE.DEBUG);
|
|
|
- const basicResponse = await fetch('/list_theta_rho_files');
|
|
|
|
|
- const basicPatterns = await basicResponse.json();
|
|
|
|
|
|
|
+ const basicPatterns = await getCachedPatternFiles();
|
|
|
const thrPatterns = basicPatterns.filter(file => file.endsWith('.thr'));
|
|
const thrPatterns = basicPatterns.filter(file => file.endsWith('.thr'));
|
|
|
logMessage(`Received ${thrPatterns.length} basic patterns from server`, LOG_TYPE.INFO);
|
|
logMessage(`Received ${thrPatterns.length} basic patterns from server`, LOG_TYPE.INFO);
|
|
|
|
|
|
|
@@ -1107,7 +1106,10 @@ function setupPreviewPanelEvents(pattern) {
|
|
|
if (result.success) {
|
|
if (result.success) {
|
|
|
logMessage(`Pattern deleted successfully: ${pattern}`, LOG_TYPE.SUCCESS);
|
|
logMessage(`Pattern deleted successfully: ${pattern}`, LOG_TYPE.SUCCESS);
|
|
|
showStatusMessage(`Pattern "${pattern.split('/').pop()}" deleted successfully`);
|
|
showStatusMessage(`Pattern "${pattern.split('/').pop()}" deleted successfully`);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // Invalidate pattern files cache
|
|
|
|
|
+ invalidatePatternFilesCache();
|
|
|
|
|
+
|
|
|
// Clear from in-memory caches
|
|
// Clear from in-memory caches
|
|
|
previewCache.delete(pattern);
|
|
previewCache.delete(pattern);
|
|
|
imageCache.delete(pattern);
|
|
imageCache.delete(pattern);
|
|
@@ -1642,11 +1644,14 @@ function setupUploadEventHandlers() {
|
|
|
const result = await response.json();
|
|
const result = await response.json();
|
|
|
if (result.success) {
|
|
if (result.success) {
|
|
|
successCount++;
|
|
successCount++;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // Invalidate pattern files cache to include new file
|
|
|
|
|
+ invalidatePatternFilesCache();
|
|
|
|
|
+
|
|
|
// Clear any existing cache for this pattern to ensure fresh loading
|
|
// Clear any existing cache for this pattern to ensure fresh loading
|
|
|
const newPatternPath = `custom_patterns/${file.name}`;
|
|
const newPatternPath = `custom_patterns/${file.name}`;
|
|
|
previewCache.delete(newPatternPath);
|
|
previewCache.delete(newPatternPath);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
logMessage(`Successfully uploaded: ${file.name}`, LOG_TYPE.SUCCESS);
|
|
logMessage(`Successfully uploaded: ${file.name}`, LOG_TYPE.SUCCESS);
|
|
|
} else {
|
|
} else {
|
|
|
failCount++;
|
|
failCount++;
|