From 72adf7b8ecb92cebc31ef7bc5929b60934a8fcc2 Mon Sep 17 00:00:00 2001 From: hujiahao-hjh <82502479+hujiahao-hjh@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:48:26 +0800 Subject: [PATCH] fix: project info edit labels bug (#3944) --- shell/app/modules/org/pages/projects/settings/info/index.tsx | 2 +- .../modules/project/common/components/section-info-edit.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/app/modules/org/pages/projects/settings/info/index.tsx b/shell/app/modules/org/pages/projects/settings/info/index.tsx index 7d9e32074..1c306127a 100644 --- a/shell/app/modules/org/pages/projects/settings/info/index.tsx +++ b/shell/app/modules/org/pages/projects/settings/info/index.tsx @@ -471,7 +471,7 @@ const Info = () => { { - updatePrj({ ...result, labels: labels?.split(',') }).then(() => { + updatePrj({ ...result, labels: (Array.isArray(labels) ? labels : labels?.split(',')) || [] }).then(() => { updater.projectInfoEditVisible(false); updater.projectInfoSaveDisabled(true); }); diff --git a/shell/app/modules/project/common/components/section-info-edit.tsx b/shell/app/modules/project/common/components/section-info-edit.tsx index 878fa3b5a..007a84efd 100644 --- a/shell/app/modules/project/common/components/section-info-edit.tsx +++ b/shell/app/modules/project/common/components/section-info-edit.tsx @@ -60,7 +60,9 @@ class SectionInfoEdit extends React.Component { }; handleSubmit = ({ labels, ...rest }: Obj) => { - return Promise.resolve(this.props.updateInfo({ ...rest, labels: labels ? labels.split(',') : [] })).then(() => { + return Promise.resolve( + this.props.updateInfo({ ...rest, labels: (Array.isArray(labels) ? labels : labels?.split(',')) || [] }), + ).then(() => { this.toggleModal(); }); };