fix: current selected role templates will be clear after select a other role (#5276)

#### What type of PR is this?

/area console
/kind bug
/milestone 2.12.x

#### What this PR does / why we need it:

修复创建角色时,勾选某个角色模板导致已选角色模板被清空的问题。

#### Which issue(s) this PR fixes:

Fixes #5275 

#### Does this PR introduce a user-facing change?

```release-note
None
```
pull/3818/head^2 v2.12.0-beta.2
Ryan Wang 2024-01-29 18:02:25 +08:00 committed by GitHub
parent 2de03851c4
commit a4e862cfc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -277,10 +277,10 @@ export function useRoleTemplateSelection(
return;
}
selectedRoleTemplates.value = new Set([
role.metadata.name,
...resolveDeepDependencies(role, roleTemplates.value || []),
]);
selectedRoleTemplates.value.add(role.metadata.name);
resolveDeepDependencies(role, roleTemplates.value || []).forEach((name) => {
selectedRoleTemplates.value.add(name);
});
};
return {