From 825b3c33bf69c1fca659815b3a41c2db7f564cbf Mon Sep 17 00:00:00 2001 From: llj Date: Fri, 1 Dec 2023 11:53:51 +0800 Subject: [PATCH] [system admin - users] role selector: make it be compatible with old data(roles not in the present availableRoles (#5806) --- frontend/src/pages/sys-admin/users/users-content.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/sys-admin/users/users-content.js b/frontend/src/pages/sys-admin/users/users-content.js index 2e66253338f..5b616581ff5 100644 --- a/frontend/src/pages/sys-admin/users/users-content.js +++ b/frontend/src/pages/sys-admin/users/users-content.js @@ -426,7 +426,11 @@ class Item extends Component { isSelected: item == curRole }; }); - currentSelectedRoleOption = this.roleOptions.filter(item => item.isSelected)[0]; + currentSelectedRoleOption = this.roleOptions.filter(item => item.isSelected)[0] || { // `|| {...}`: to be compatible with old data(roles not in the present `availableRoles` + value: curRole, + text: this.translateRole(curRole), + isSelected: true + }; } let currentSelectedInstOption;