fix save and run recipe not working (#7186)

This commit is contained in:
Zane
2026-02-12 11:52:39 -08:00
committed by GitHub
parent 4cd39afbbe
commit d90fde19bd
2 changed files with 15 additions and 7 deletions
@@ -1,6 +1,12 @@
import React, { useState, useEffect, useCallback } from 'react';
import { useForm } from '@tanstack/react-form';
import { Recipe, generateDeepLink, Parameter } from '../../recipe';
import {
Recipe,
generateDeepLink,
Parameter,
encodeRecipe,
stripEmptyExtensions,
} from '../../recipe';
import { Check, ExternalLink, Play, Save, X } from 'lucide-react';
import { Geese } from '../icons/Geese';
import Copy from '../icons/Copy';
@@ -327,19 +333,20 @@ export default function CreateEditRecipeModal({
try {
const recipe = getCurrentRecipe();
let saved_recipe_id = await saveRecipe(recipe, recipeId);
await saveRecipe(recipe, recipeId);
// Close modal first
onClose(true);
// Open recipe in a new window instead of navigating in the same window
// Encode the recipe as a deeplink before passing to the new window
const encodedRecipe = await encodeRecipe(stripEmptyExtensions(recipe));
window.electron.createChatWindow(
undefined,
undefined,
undefined,
undefined,
undefined,
saved_recipe_id
encodedRecipe
);
toastSuccess({
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react';
import { useForm } from '@tanstack/react-form';
import { Recipe } from '../../recipe';
import { Recipe, encodeRecipe, stripEmptyExtensions } from '../../recipe';
import { Geese } from '../icons/Geese';
import { X, Save, Play, Loader2 } from 'lucide-react';
import { Button } from '../ui/button';
@@ -182,19 +182,20 @@ export default function CreateRecipeFromSessionModal({
: undefined,
};
let recipeId = await saveRecipe(recipe, null);
await saveRecipe(recipe, null);
onRecipeCreated?.(recipe);
onClose();
if (runAfterSave) {
const encodedRecipe = await encodeRecipe(stripEmptyExtensions(recipe));
window.electron.createChatWindow(
undefined,
undefined,
undefined,
undefined,
undefined,
recipeId
encodedRecipe
);
}
} catch (error) {