Skip to content

Commit 85221ca

Browse files
author
Daniel Duong
committed
fix(automl/configure, autorag/configure): address coderabbit
1 parent 16132d2 commit 85221ca

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

packages/automl/frontend/src/app/pages/__tests__/AutomlConfigurePage.spec.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ jest.mock('mod-arch-core', () => ({
3232
}));
3333

3434
jest.mock('~/app/hooks/mutations', () => ({
35-
usePipelineRunsMutation: jest.fn(() => ({
35+
useCreatePipelineRunMutation: jest.fn(() => ({
3636
mutateAsync: mockMutateAsync,
3737
})),
3838
}));
3939

4040
jest.mock('~/app/hooks/queries', () => ({
41-
useFilesQuery: jest.fn(() => ({
41+
useS3GetFileSchemaQuery: jest.fn(() => ({
4242
data: [
4343
{ name: 'column1', type: 'string' },
4444
{ name: 'column2', type: 'int64' },
@@ -404,9 +404,13 @@ describe('AutomlConfigurePage', () => {
404404
const backButton = await screen.findByRole('button', { name: 'Back' });
405405
await user.click(backButton);
406406

407+
// Re-query inputs after navigation (DOM elements are remounted)
408+
const nameInputAfterBack = await screen.findByLabelText(/Name/i);
409+
const descriptionInputAfterBack = await screen.findByLabelText(/Description/i);
410+
407411
// Verify form data is preserved
408-
expect(nameInput).toHaveValue('Preserved Name');
409-
expect(descriptionInput).toHaveValue('Preserved Description');
412+
expect(nameInputAfterBack).toHaveValue('Preserved Name');
413+
expect(descriptionInputAfterBack).toHaveValue('Preserved Description');
410414
});
411415
});
412416

packages/automl/frontend/src/app/schemas/configure.schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function createConfigureSchema() {
2222
return createSchema({
2323
schema: z.object({
2424
// Common fields
25-
display_name: z.string().default(''),
25+
display_name: z.string().min(1).default(''),
2626
description: z.string().default('').optional(),
2727
task_type: z.enum(TASK_TYPES).default(TASK_TYPE_BINARY),
2828
train_data_secret_name: z.string().min(1).default(''),

packages/autorag/frontend/src/app/components/configure/AutoragConfigure.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,8 @@ function AutoragConfigure(): React.JSX.Element {
194194
value={selectedSecret?.uuid}
195195
onChange={(secret) => {
196196
if (!secret) {
197-
setValue('input_data_secret_name', '', {
198-
shouldValidate: true,
199-
});
197+
setSelectedSecret(undefined);
198+
onChange('');
200199
return;
201200
}
202201

0 commit comments

Comments
 (0)