Skip to content

Commit

Permalink
Await before deleting frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
pierr3 committed May 9, 2024
1 parent 98ce5e7 commit 9ab03ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/components/bootstrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const Bootsrap: React.FC = () => {
if (useRadioState.getState().isInactive(parseInt(frequency))) {
return;
}

useRadioState.getState().setCurrentlyRx(parseInt(frequency), false);
});

Expand Down
17 changes: 15 additions & 2 deletions src/app/components/sidebar/radio-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,21 @@ const RadioStatus: React.FC = () => {
if (!selectedRadio) {
return;
}
void window.api.removeFrequency(selectedRadio.frequency);
removeRadio(selectedRadio.frequency);
void window.api
.setFrequencyState(
selectedRadio.frequency,
false,
false,
false,
false,
false,
)
.then(() => {
setTimeout(() => {
void window.api.removeFrequency(selectedRadio.frequency);
removeRadio(selectedRadio.frequency);
}, 500);
});
};

const handleForceRefresh = () => {
Expand Down

0 comments on commit 9ab03ee

Please sign in to comment.