refactor: change open recipe in new window to pass recipe id (#7392)

This commit is contained in:
Zane
2026-02-23 07:24:00 -08:00
committed by GitHub
parent 33af64406b
commit ffed9dfc4f
12 changed files with 162 additions and 198 deletions
@@ -1,12 +1,6 @@
import React, { useState, useEffect, useCallback } from 'react';
import { useForm } from '@tanstack/react-form';
import {
Recipe,
generateDeepLink,
Parameter,
encodeRecipe,
stripEmptyExtensions,
} from '../../recipe';
import { Recipe, generateDeepLink, Parameter } from '../../recipe';
import { Check, ExternalLink, Play, Save, X } from 'lucide-react';
import { Geese } from '../icons/Geese';
import Copy from '../icons/Copy';
@@ -333,21 +327,12 @@ export default function CreateEditRecipeModal({
try {
const recipe = getCurrentRecipe();
await saveRecipe(recipe, recipeId);
const savedId = await saveRecipe(recipe, recipeId);
// Close modal first
onClose(true);
// 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,
encodedRecipe
);
window.electron.createChatWindow({ recipeId: savedId });
toastSuccess({
title: recipe.title,