Skip to content

Commit

Permalink
Set editing profile index correctly when deleting profile (#1560)
Browse files Browse the repository at this point in the history
* handle editing profile index correctly when delete profile

* lint

* simplify index calculation

* rename variables

* Revert "rename variables"

This reverts commit 4d81d24.
  • Loading branch information
khaitruong922 authored Nov 4, 2024
1 parent 37ba526 commit afd0b67
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ext/js/pages/settings/profile-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,10 @@ export class ProfileController {
this._updateProfileSelectOptions();

// Update profile index
if (settingsProfileIndex === profileIndex) {
this._settingsController.profileIndex = profileCurrentNew;
if (settingsProfileIndex >= profileIndex) {
this._settingsController.profileIndex = settingsProfileIndex - 1;
} else {
this._settingsController.refreshProfileIndex();
}

// Modify settings
Expand Down
5 changes: 5 additions & 0 deletions ext/js/pages/settings/settings-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ export class SettingsController extends EventDispatcher {
this._setProfileIndex(value, true);
}

/** */
refreshProfileIndex() {
this._setProfileIndex(this._profileIndex, true);
}

/** @type {HtmlTemplateCollection} */
get templates() {
return this._templates;
Expand Down

0 comments on commit afd0b67

Please sign in to comment.