Skip to content

Commit c9d8f28

Browse files
author
Keivan Vosoughi
committed
Fix Regenerate Issues
1 parent 7331eef commit c9d8f28

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

app/client/src/pages/DataGenerator/Configure.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ const Configure = () => {
5757
useEffect(() => {
5858
if (wizardModeType === WizardModeType.DATA_AUGMENTATION) {
5959
setWizardModeType(WizardModeType.DATA_AUGMENTATION);
60-
form.setFieldValue('workflow_type', 'custom');
60+
form.setFieldValue('workflow_type', 'freeform');
6161
} else {
6262
setWizardModeType(WizardModeType.DATA_GENERATION);
63-
form.setFieldValue('workflow_type', 'freeform');
63+
form.setFieldValue('workflow_type', 'custom');
6464
}
6565
}, [location, wizardModeType]);
6666

@@ -147,6 +147,8 @@ const Configure = () => {
147147
}
148148
}
149149

150+
console.log('Configure --> form', form.getFieldsValue());
151+
150152
return (
151153
<StepContainer justify='center'>
152154
<FormContainer vertical>

app/client/src/pages/DataGenerator/DataGenerator.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,40 @@ const DataGenerator: FunctionComponent<Props> = () => {
115115

116116

117117
useEffect(() => {
118+
console.log('useEffect generate_file_name', generate_file_name);
118119
if (generate_file_name && !mutation.data) {
119120
mutation.mutate(generate_file_name);
120121
}
122+
console.log('mutation.data', mutation.data);
123+
121124
if (mutation.data && mutation?.data?.dataset) {
125+
console.log('setting form values', {
126+
...initialData,
127+
...(mutation?.data?.dataset as any)
128+
});
122129
form.setFieldsValue({
123130
...initialData,
124131
...(mutation?.data?.dataset as any)
125132
});
133+
console.log('------> form', form.getFieldsValue());
126134
}
127135

128136
}, [generate_file_name]);
137+
138+
useEffect(() => {
139+
console.log('useEffect mutation.data', mutation.data);
140+
if (mutation.data && mutation?.data?.dataset) {
141+
console.log('setting form values', {
142+
...initialData,
143+
...(mutation?.data?.dataset as any)
144+
});
145+
form.setFieldsValue({
146+
...initialData,
147+
...(mutation?.data?.dataset as any)
148+
});
149+
console.log('------> form', form.getFieldsValue());
150+
}
151+
}, [mutation.data]);
129152

130153

131154
if (initialData?.technique) {
@@ -175,6 +198,9 @@ const DataGenerator: FunctionComponent<Props> = () => {
175198

176199
const prev = () => setCurrent(Math.max(0, current - 1))
177200

201+
console.log('formData', formData.current);
202+
console.log('form', form.getFieldsValue());
203+
178204
return (
179205
<WizardCtx.Provider value={{ setIsStepValid }}>
180206
<Layout style={{ paddingBottom: 45 }}>

app/client/src/pages/DataGenerator/Examples.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import FreeFormExampleTable from './FreeFormExampleTable';
1818
import { L } from 'vitest/dist/chunks/reporters.DTtkbAtP.js';
1919
import Loading from '../Evaluator/Loading';
2020
import { isEqual, set } from 'lodash';
21+
import { useParams } from 'react-router-dom';
2122

2223
const { Title, Text } = Typography;
2324
const Container = styled.div`
@@ -52,9 +53,12 @@ const StyledContainer = styled.div`
5253

5354
const Examples: FunctionComponent = () => {
5455
const form = Form.useFormInstance();
56+
const { template_name, generate_file_name } = useParams();
5557
const [records, setRecords] = useState<Record<string, string>[]>([]);
5658
const workflowType = form.getFieldValue('workflow_type');
5759

60+
console.log('Examples >>> form:', form.getFieldsValue());
61+
5862
const mutation = useMutation({
5963
mutationFn: fetchFileContent
6064
});

0 commit comments

Comments
 (0)