Fix review comments
| @@ -52,7 +52,7 @@ const FANCY_NAMES = { | |||
| 52 | /** @type {() => SlashCommandEnumValue[]} */ | 52 | /** @type {() => SlashCommandEnumValue[]} */ |
| 53 | const profilesProvider = () => [ | 53 | const 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 | ]; |
| 57 | 57 | ||
| 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); |
| 311 | 311 | ||
| 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); |
| 313 | 318 | ||
| 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 | })); |
| 465 | 472 | ||