Merge pull request #748 from wzdnzd/master
reset selectedClashAPIConfigIndex when remove clashApiConfig
This commit is contained in:
commit
cd64985500
1 changed files with 5 additions and 0 deletions
|
@ -55,6 +55,11 @@ export function removeClashAPIConfig(conf: ClashAPIConfig) {
|
|||
const idx = findClashAPIConfigIndex(getState, conf);
|
||||
dispatch('removeClashAPIConfig', (s) => {
|
||||
s.app.clashAPIConfigs.splice(idx, 1);
|
||||
if (idx === s.app.selectedClashAPIConfigIndex) {
|
||||
s.app.selectedClashAPIConfigIndex = 0;
|
||||
} else if (idx < s.app.selectedClashAPIConfigIndex) {
|
||||
s.app.selectedClashAPIConfigIndex -= 1;
|
||||
}
|
||||
});
|
||||
// side effect
|
||||
saveState(getState().app);
|
||||
|
|
Loading…
Reference in a new issue