Skip to content

Commit c55306d

Browse files
earayu梅西
andauthored
fix(desktop): keep workflow cancel in current window (#27)
Co-authored-by: 梅西 <messi-agent@users.noreply.github.com>
1 parent b9fecd3 commit c55306d

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

ui/desktop/src/components/ParameterInputModal.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState, useEffect } from 'react';
2+
import { useNavigate } from 'react-router-dom';
23
import { Parameter } from '../recipe';
34
import { Button } from './ui/button';
4-
import { getInitialWorkingDir } from '../utils/workingDir';
55
import { defineMessages, useIntl } from '../i18n';
66

77
const i18n = defineMessages({
@@ -69,6 +69,7 @@ const ParameterInputModal: React.FC<ParameterInputModalProps> = ({
6969
initialValues,
7070
}) => {
7171
const intl = useIntl();
72+
const navigate = useNavigate();
7273
const [inputValues, setInputValues] = useState<Record<string, string>>({});
7374
const [validationErrors, setValidationErrors] = useState<Record<string, string>>({});
7475
const [showCancelOptions, setShowCancelOptions] = useState(false);
@@ -126,14 +127,7 @@ const ParameterInputModal: React.FC<ParameterInputModalProps> = ({
126127

127128
const handleCancelOption = (option: 'new-chat' | 'back-to-form'): void => {
128129
if (option === 'new-chat') {
129-
try {
130-
const workingDir = getInitialWorkingDir();
131-
window.electron.createChatWindow({ dir: workingDir });
132-
window.electron.hideWindow();
133-
} catch (error) {
134-
console.error('Error creating new window:', error);
135-
onClose();
136-
}
130+
navigate('/pair');
137131
} else {
138132
setShowCancelOptions(false); // Go back to the parameter form
139133
}

0 commit comments

Comments
 (0)