Fix channel configured status (#44)
This commit is contained in:
committed by
GitHub
Unverified
parent
92c1b68a54
commit
01f4d4800e
@@ -59,17 +59,6 @@ export function Channels() {
|
||||
fetchChannels();
|
||||
}, [fetchChannels]);
|
||||
|
||||
useEffect(() => {
|
||||
const unsubscribe = window.electron.ipcRenderer.on('gateway:channel-status', () => {
|
||||
fetchChannels();
|
||||
});
|
||||
return () => {
|
||||
if (typeof unsubscribe === 'function') {
|
||||
unsubscribe();
|
||||
}
|
||||
};
|
||||
}, [fetchChannels]);
|
||||
|
||||
// Fetch configured channel types from config file
|
||||
const fetchConfiguredTypes = useCallback(async () => {
|
||||
try {
|
||||
@@ -90,6 +79,18 @@ export function Channels() {
|
||||
void fetchConfiguredTypes();
|
||||
}, [fetchConfiguredTypes]);
|
||||
|
||||
useEffect(() => {
|
||||
const unsubscribe = window.electron.ipcRenderer.on('gateway:channel-status', () => {
|
||||
fetchChannels();
|
||||
fetchConfiguredTypes();
|
||||
});
|
||||
return () => {
|
||||
if (typeof unsubscribe === 'function') {
|
||||
unsubscribe();
|
||||
}
|
||||
};
|
||||
}, [fetchChannels, fetchConfiguredTypes]);
|
||||
|
||||
// Get channel types to display
|
||||
const displayedChannelTypes = showAllChannels ? getAllChannels() : getPrimaryChannels();
|
||||
|
||||
@@ -205,7 +206,9 @@ export function Channels() {
|
||||
channel={channel}
|
||||
onDelete={() => {
|
||||
if (confirm('Are you sure you want to delete this channel?')) {
|
||||
deleteChannel(channel.id);
|
||||
deleteChannel(channel.id).then(() => {
|
||||
fetchConfiguredTypes();
|
||||
});
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user