From f6ef4280083c2af627d51a12b8a854b7f0363b01 Mon Sep 17 00:00:00 2001 From: Will Miao <13051207myq@gmail.com> Date: Mon, 23 Jun 2025 15:29:22 +0800 Subject: [PATCH] feat: update preview URL handling in RecipeRoutes and optimize recipe refresh logic in RecipeModal. Fixes #244 --- py/routes/recipe_routes.py | 2 +- static/js/components/RecipeModal.js | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/py/routes/recipe_routes.py b/py/routes/recipe_routes.py index e264ed16..85cd86ed 100644 --- a/py/routes/recipe_routes.py +++ b/py/routes/recipe_routes.py @@ -1373,7 +1373,7 @@ class RecipeRoutes: json.dump(recipe_data, f, indent=4, ensure_ascii=False) updated_lora['inLibrary'] = True - updated_lora['preview_url'] = target_lora['preview_url'] + updated_lora['preview_url'] = config.get_preview_static_url(target_lora['preview_url']) updated_lora['localPath'] = target_lora['file_path'] # Update in cache if it exists diff --git a/static/js/components/RecipeModal.js b/static/js/components/RecipeModal.js index 8e7dbb09..ce5070a0 100644 --- a/static/js/components/RecipeModal.js +++ b/static/js/components/RecipeModal.js @@ -989,13 +989,10 @@ class RecipeModal { setTimeout(() => { this.showRecipeDetails(this.currentRecipe); }, 500); - - // Refresh recipes list - if (window.recipeManager && typeof window.recipeManager.loadRecipes === 'function') { - setTimeout(() => { - window.recipeManager.loadRecipes(true); - }, 1000); - } + + state.virtualScroller.updateSingleItem(this.currentRecipe.file_path, { + loras: this.currentRecipe.loras + }); } else { showToast(`Error: ${result.error}`, 'error'); }