Fix review comments

00f6941e936a68e7c9cbdc3acb879a577eab2297

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

1 files changed, +8 -1Ignore whitespace
public/scripts/extensions/connection-manager/index.js+8 -1
@@ -52,7 +52,7 @@ const FANCY_NAMES = {
52/** @type {() => SlashCommandEnumValue[]} */52/** @type {() => SlashCommandEnumValue[]} */
53const profilesProvider = () => [53const profilesProvider = () => [
54 new SlashCommandEnumValue(NONE, NONE),54 new SlashCommandEnumValue(NONE, NONE),
55 ...extension_settings.connectionManager.profiles.map(p => new SlashCommandEnumValue(p.name, p.name, enumTypes.name, enumIcons.server)),55 ...extension_settings.connectionManager.profiles.map(p => new SlashCommandEnumValue(p.name, null, enumTypes.name, enumIcons.server)),
56];56];
5757
58/**58/**
@@ -309,6 +309,11 @@ async function renderDetailsContent(details, detailsContent) {
309 saveSettingsDebounced();309 saveSettingsDebounced();
310 await renderDetailsContent(details, detailsContent);310 await renderDetailsContent(details, detailsContent);
311311
312 // None option selected
313 if (!profileId) {
314 return;
315 }
316
312 const profile = extension_settings.connectionManager.profiles.find(p => p.id === profileId);317 const profile = extension_settings.connectionManager.profiles.find(p => p.id === profileId);
313318
314 if (!profile) {319 if (!profile) {
@@ -455,11 +460,13 @@ async function renderDetailsContent(details, detailsContent) {
455 const selectedProfile = extension_settings.connectionManager.selectedProfile;460 const selectedProfile = extension_settings.connectionManager.selectedProfile;
456 const profile = extension_settings.connectionManager.profiles.find(p => p.id === selectedProfile);461 const profile = extension_settings.connectionManager.profiles.find(p => p.id === selectedProfile);
457 if (!profile) {462 if (!profile) {
463 toastr.warning('No profile selected.');
458 return '';464 return '';
459 }465 }
460 await updateConnectionProfile(profile);466 await updateConnectionProfile(profile);
461 await renderDetailsContent(details, detailsContent);467 await renderDetailsContent(details, detailsContent);
462 saveSettingsDebounced();468 saveSettingsDebounced();
469 return profile.name;
463 },470 },
464 }));471 }));
465472