diff --git a/ui/desktop/src/components/RecipesView.tsx b/ui/desktop/src/components/RecipesView.tsx index a13c0e00db2d..674b350cde85 100644 --- a/ui/desktop/src/components/RecipesView.tsx +++ b/ui/desktop/src/components/RecipesView.tsx @@ -372,67 +372,90 @@ Parameters you can use: } }; - // Render a recipe item - const RecipeItem = ({ savedRecipe }: { savedRecipe: SavedRecipe }) => ( - -
-
-
-

{savedRecipe.recipe.title}

- {savedRecipe.isGlobal ? ( - - ) : ( - - )} + // Render a recipe item with error handling + const RecipeItem = ({ savedRecipe }: { savedRecipe: SavedRecipe }) => { + try { + return ( + +
+
+
+

{savedRecipe.recipe.title}

+ {savedRecipe.isGlobal ? ( + + ) : ( + + )} +
+

+ {savedRecipe.recipe.description} +

+
+ + {savedRecipe.lastModified.toLocaleDateString()} +
+
+ +
+ + + +
-

- {savedRecipe.recipe.description} -

-
- - {savedRecipe.lastModified.toLocaleDateString()} + + ); + } catch (error) { + // Error row showing failed to read file with filename and error details + return ( + +
+
+
+ +

+ Failed to read file: {savedRecipe.filename} +

+
+

+ {error instanceof Error ? error.message : 'Unknown error'} +

+
-
- -
- - - -
-
- - ); + + ); + } + }; // Render skeleton loader for recipe items const RecipeSkeleton = () => ( diff --git a/ui/desktop/src/recipe/recipeStorage.ts b/ui/desktop/src/recipe/recipeStorage.ts index d74b630863b4..bd40aa051baf 100644 --- a/ui/desktop/src/recipe/recipeStorage.ts +++ b/ui/desktop/src/recipe/recipeStorage.ts @@ -12,6 +12,7 @@ export interface SavedRecipe { isGlobal: boolean; lastModified: Date; isArchived?: boolean; + filename: string; // The actual filename used } /** @@ -66,6 +67,7 @@ async function loadRecipeFromFile( return { ...recipeData, isGlobal: isGlobal, + filename: recipeName, }; } catch (error) { console.warn(`Failed to load recipe from ${filePath}:`, error); @@ -112,6 +114,7 @@ export async function saveRecipe(recipe: Recipe, options: SaveRecipeOptions): Pr // Create saved recipe object const savedRecipe: SavedRecipe = { name: sanitizedName, + filename: sanitizedName, recipe: recipe, isGlobal: global, lastModified: new Date(),