Skip to content

Commit f19a6fe

Browse files
committed
fix(FR-2475): add fetchKey prop to ProjectSelect for data refetch on modal open
1 parent f819ac5 commit f19a6fe

4 files changed

Lines changed: 18 additions & 1 deletion

File tree

e2e/utils/test-util.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,11 @@ export async function modifyConfigToml(
751751
if (!res.ok) throw new Error(`HTTP ${res.status}`);
752752
return res.text();
753753
});
754-
config = TOML.parse(configToml);
754+
// Pre-process TOML to remove duplicate keys before parsing.
755+
// Some server configurations may have duplicate keys (e.g., debug = true
756+
// appearing twice under [general]) which strict TOML parsers reject.
757+
const deduplicatedToml = deduplicateTomlKeys(configToml);
758+
config = TOML.parse(deduplicatedToml);
755759
break; // Success, exit retry loop
756760
} catch (error) {
757761
lastError = error;

react/src/components/ProjectSelect.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ export interface ProjectSelectProps extends BAISelectProps {
2525
autoSelectDefault?: boolean;
2626
disableDefaultFilter?: boolean;
2727
lockedProjectTypes?: string[];
28+
fetchKey?: string;
2829
}
2930

3031
const ProjectSelect: React.FC<ProjectSelectProps> = ({
3132
onSelectProject,
3233
domain,
3334
disableDefaultFilter,
3435
lockedProjectTypes,
36+
fetchKey,
3537
...selectProps
3638
}) => {
3739
const { t } = useTranslation();
@@ -74,6 +76,7 @@ const ProjectSelect: React.FC<ProjectSelectProps> = ({
7476
},
7577
{
7678
fetchPolicy: 'store-and-network',
79+
fetchKey: fetchKey,
7780
},
7881
);
7982

react/src/components/UpdateUsersModal.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
useBAILogger,
1717
useErrorMessageResolver,
1818
useMutationWithPromise,
19+
useUpdatableState,
1920
} from 'backend.ai-ui';
2021
import _ from 'lodash';
2122
import { Suspense, useRef, useState } from 'react';
@@ -50,6 +51,7 @@ const UpdateUsersModal = ({
5051
'use memo';
5152
const formRef = useRef<FormInstance<UpdateUsersFormValues>>(null);
5253
const [isPending, setIsPending] = useState(false);
54+
const [fetchKey, updateFetchKey] = useUpdatableState('initial-fetch');
5355
const { token } = theme.useToken();
5456
const { t } = useTranslation();
5557
const { message } = App.useApp();
@@ -88,6 +90,12 @@ const UpdateUsersModal = ({
8890
okText={t('button.Update')}
8991
confirmLoading={isPending}
9092
{...modalProps}
93+
afterOpenChange={(open) => {
94+
if (open) {
95+
updateFetchKey();
96+
}
97+
modalProps.afterOpenChange?.(open);
98+
}}
9199
onOk={(e) => {
92100
formRef.current
93101
?.validateFields()
@@ -232,6 +240,7 @@ const UpdateUsersModal = ({
232240
domain={getFieldValue('domain_name')}
233241
disableDefaultFilter
234242
disabled={!getFieldValue('domain_name')}
243+
fetchKey={fetchKey}
235244
/>
236245
</Form.Item>
237246
)}

react/src/components/UserSettingModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,7 @@ const UserSettingModal: React.FC<UserSettingModalProps> = ({
874874
domain={getFieldValue('domain_name')}
875875
disableDefaultFilter
876876
lockedProjectTypes={!user ? ['MODEL_STORE'] : undefined}
877+
fetchKey={fetchKey}
877878
/>
878879
</Form.Item>
879880
)}

0 commit comments

Comments
 (0)