mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
getGroupNames: Short circuit if no group selected
This commit is contained in:
@@ -280,7 +280,10 @@ export function getGroupMembers(groupId = selected_group) {
|
|||||||
* @returns {string[]} An array of character names representing the members of the group.
|
* @returns {string[]} An array of character names representing the members of the group.
|
||||||
*/
|
*/
|
||||||
export function getGroupNames() {
|
export function getGroupNames() {
|
||||||
const groupMembers = selected_group ? groups.find(x => x.id == selected_group)?.members : null;
|
if (!selected_group) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
const groupMembers = groups.find(x => x.id == selected_group)?.members;
|
||||||
return Array.isArray(groupMembers)
|
return Array.isArray(groupMembers)
|
||||||
? groupMembers.map(x => characters.find(y => y.avatar === x)?.name).filter(x => x)
|
? groupMembers.map(x => characters.find(y => y.avatar === x)?.name).filter(x => x)
|
||||||
: [];
|
: [];
|
||||||
|
Reference in New Issue
Block a user