Fix review comments

00f6941e936a68e7c9cbdc3acb879a577eab2297

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +8 -1Showing whitespace changes
public/scripts/extensions/connection-manager/index.js+8 -1
@@ -52,7 +52,7 @@ const FANCY_NAMES = {
5252/** @type {() => SlashCommandEnumValue[]} */
5353const profilesProvider = () => [
5454 new SlashCommandEnumValue(NONE, NONE),
5555 ...extension_settings.connectionManager.profiles.map(p => new SlashCommandEnumValue(p.name, p.namenull, enumTypes.name, enumIcons.server)),
5656];
5757
5858/**
@@ -309,6 +309,11 @@ async function renderDetailsContent(details, detailsContent) {
309309 saveSettingsDebounced();
310310 await renderDetailsContent(details, detailsContent);
311311
312+ // None option selected
313+ if (!profileId) {
314+ return;
315+ }
316+
312317 const profile = extension_settings.connectionManager.profiles.find(p => p.id === profileId);
313318
314319 if (!profile) {
@@ -455,11 +460,13 @@ async function renderDetailsContent(details, detailsContent) {
455460 const selectedProfile = extension_settings.connectionManager.selectedProfile;
456461 const profile = extension_settings.connectionManager.profiles.find(p => p.id === selectedProfile);
457462 if (!profile) {
463+ toastr.warning('No profile selected.');
458464 return '';
459465 }
460466 await updateConnectionProfile(profile);
461467 await renderDetailsContent(details, detailsContent);
462468 saveSettingsDebounced();
469+ return profile.name;
463470 },
464471 }));
465472