Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,14 @@ const ConfigPage = () => {
`${msg}${i18nInstance.t('a6d38572262cb1b1238d449b4098f002', '配置成功')}`,
);
hideEditor();
if (editor.mode === 'create') {
await queryClient.invalidateQueries({
queryKey: ['GetConfigMaps'],
exact: false,
});
}
await queryClient.invalidateQueries({
queryKey: [
filter.kind === ConfigKind.ConfigMap
? 'GetConfigMaps'
: 'GetSecrets',
Comment on lines +158 to +160
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve maintainability and avoid using 'magic strings' for query keys, it's a good practice to define 'GetConfigMaps' and 'GetSecrets' as constants. These constants could be placed in a shared file (e.g., types.ts or a new queryKeys.ts) and then imported for use here and in the ConfigMapTable and SecretTable components where the queries are defined. This ensures consistency and simplifies future refactoring.

],
exact: false,
});
} else {
await messageApi.error(
`${msg}${i18nInstance.t('03d3b00687bbab3e9a7e1bd3aeeaa0a4', '配置失败')}`,
Expand Down