fix: Load and Use recipes in new window (#3501)

This commit is contained in:
Jarrod Sibbison
2025-07-19 01:18:14 +10:00
committed by GitHub
parent a1463e6674
commit eb5e8b6f4e
+11 -6
View File
@@ -29,7 +29,8 @@ interface RecipesViewProps {
onLoadRecipe?: (recipe: Recipe) => void; onLoadRecipe?: (recipe: Recipe) => void;
} }
export default function RecipesView({ onLoadRecipe }: RecipesViewProps = {}) { // @ts-expect-error until we make onLoadRecipe work for loading recipes in the same window
export default function RecipesView({ _onLoadRecipe }: RecipesViewProps = {}) {
const [savedRecipes, setSavedRecipes] = useState<SavedRecipe[]>([]); const [savedRecipes, setSavedRecipes] = useState<SavedRecipe[]>([]);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [showSkeleton, setShowSkeleton] = useState(true); const [showSkeleton, setShowSkeleton] = useState(true);
@@ -93,10 +94,14 @@ export default function RecipesView({ onLoadRecipe }: RecipesViewProps = {}) {
const handleLoadRecipe = async (savedRecipe: SavedRecipe) => { const handleLoadRecipe = async (savedRecipe: SavedRecipe) => {
try { try {
if (onLoadRecipe) { // onLoadRecipe is not working for loading recipes. It looks correct
// Use the callback to navigate within the same window // but the instructions are not flowing through to the server.
onLoadRecipe(savedRecipe.recipe); // Needs a fix but commenting out to get prod back up and running.
} else { //
// if (onLoadRecipe) {
// // Use the callback to navigate within the same window
// onLoadRecipe(savedRecipe.recipe);
// } else {
// Fallback to creating a new window (for backwards compatibility) // Fallback to creating a new window (for backwards compatibility)
window.electron.createChatWindow( window.electron.createChatWindow(
undefined, // query undefined, // query
@@ -106,7 +111,7 @@ export default function RecipesView({ onLoadRecipe }: RecipesViewProps = {}) {
savedRecipe.recipe, // recipe config savedRecipe.recipe, // recipe config
undefined // view type undefined // view type
); );
} // }
} catch (err) { } catch (err) {
console.error('Failed to load recipe:', err); console.error('Failed to load recipe:', err);
setError(err instanceof Error ? err.message : 'Failed to load recipe'); setError(err instanceof Error ? err.message : 'Failed to load recipe');