mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
feat: enhance model move functionality with cache entry updates
- Return cache entry data from model move operations for immediate UI updates - Add recalculate_type parameter to update_single_model_cache for proper type adjustment - Propagate cache entry through API layer to frontend MoveManager - Enable virtual scroller to update moved items with new cache data
This commit is contained in:
@@ -936,7 +936,8 @@ export class BaseModelApiClient {
|
||||
if (result.success) {
|
||||
return {
|
||||
original_file_path: result.original_file_path || filePath,
|
||||
new_file_path: result.new_file_path
|
||||
new_file_path: result.new_file_path,
|
||||
cache_entry: result.cache_entry
|
||||
};
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -327,15 +327,22 @@ class MoveManager {
|
||||
|
||||
if (!isVisible) {
|
||||
state.virtualScroller.removeItemByFilePath(result.original_file_path);
|
||||
} else if (result.new_file_path !== result.original_file_path) {
|
||||
} else {
|
||||
const newFileNameWithExt = result.new_file_path.substring(result.new_file_path.lastIndexOf('/') + 1);
|
||||
const baseFileName = newFileNameWithExt.substring(0, newFileNameWithExt.lastIndexOf('.'));
|
||||
|
||||
state.virtualScroller.updateSingleItem(result.original_file_path, {
|
||||
const updateData = {
|
||||
file_path: result.new_file_path,
|
||||
file_name: baseFileName,
|
||||
folder: newRelativeFolder
|
||||
});
|
||||
};
|
||||
|
||||
// Only update model_type if it's present in the cache_entry
|
||||
if (result.cache_entry && result.cache_entry.model_type) {
|
||||
updateData.model_type = result.cache_entry.model_type;
|
||||
}
|
||||
|
||||
state.virtualScroller.updateSingleItem(result.original_file_path, updateData);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -352,15 +359,21 @@ class MoveManager {
|
||||
if (!isVisible) {
|
||||
state.virtualScroller.removeItemByFilePath(this.currentFilePath);
|
||||
} else {
|
||||
// Update the model card even if it stays visible
|
||||
const newFileNameWithExt = result.new_file_path.substring(result.new_file_path.lastIndexOf('/') + 1);
|
||||
const baseFileName = newFileNameWithExt.substring(0, newFileNameWithExt.lastIndexOf('.'));
|
||||
|
||||
state.virtualScroller.updateSingleItem(this.currentFilePath, {
|
||||
const updateData = {
|
||||
file_path: result.new_file_path,
|
||||
file_name: baseFileName,
|
||||
folder: newRelativeFolder
|
||||
});
|
||||
};
|
||||
|
||||
// Only update model_type if it's present in the cache_entry
|
||||
if (result.cache_entry && result.cache_entry.model_type) {
|
||||
updateData.model_type = result.cache_entry.model_type;
|
||||
}
|
||||
|
||||
state.virtualScroller.updateSingleItem(this.currentFilePath, updateData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user