Skip to content

Commit

Permalink
Fixed oversight in toggle code
Browse files Browse the repository at this point in the history
  • Loading branch information
ltctceplrm committed Feb 6, 2024
1 parent c5ba44c commit f520604
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/modals/MediaDbSearchModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,17 @@ export class MediaDbSearchModal extends Modal {
currentToggle = apiToggleComponent;
}
apiToggleComponent.onChange(value => {
if (currentToggle && currentToggle !== apiToggleComponent) {
currentToggle.setValue(false);
if (value) {
if (currentToggle && currentToggle !== apiToggleComponent) {
currentToggle.setValue(false);
this.selectedTypes.find(x => x.name === mediaType).selected = false;
}
currentToggle = apiToggleComponent;
this.selectedTypes.find(x => x.name === mediaType).selected = true;
} else {
currentToggle = null;
this.selectedTypes.find(x => x.name === mediaType).selected = false;
}
currentToggle = value ? apiToggleComponent : null;
});
apiToggleComponentWrapper.appendChild(apiToggleComponent.toggleEl);
toggleComponents.push(apiToggleComponent);
Expand Down

0 comments on commit f520604

Please sign in to comment.