File tree Expand file tree Collapse file tree 2 files changed +31
-12
lines changed
Expand file tree Collapse file tree 2 files changed +31
-12
lines changed Original file line number Diff line number Diff line change @@ -271,6 +271,22 @@ export function deleteChannelConfig(channelType: string): void {
271271 delete currentConfig . channels [ channelType ] ;
272272 writeOpenClawConfig ( currentConfig ) ;
273273 console . log ( `Deleted channel config for ${ channelType } ` ) ;
274+ } else if ( PLUGIN_CHANNELS . includes ( channelType ) ) {
275+ // Handle plugin channels (like whatsapp)
276+ if ( currentConfig . plugins ?. entries ?. [ channelType ] ) {
277+ delete currentConfig . plugins . entries [ channelType ] ;
278+
279+ // Cleanup empty objects
280+ if ( Object . keys ( currentConfig . plugins . entries ) . length === 0 ) {
281+ delete currentConfig . plugins . entries ;
282+ }
283+ if ( currentConfig . plugins && Object . keys ( currentConfig . plugins ) . length === 0 ) {
284+ delete currentConfig . plugins ;
285+ }
286+
287+ writeOpenClawConfig ( currentConfig ) ;
288+ console . log ( `Deleted plugin channel config for ${ channelType } ` ) ;
289+ }
274290 }
275291
276292 // Special handling for WhatsApp credentials
Original file line number Diff line number Diff line change @@ -59,17 +59,6 @@ export function Channels() {
5959 fetchChannels ( ) ;
6060 } , [ fetchChannels ] ) ;
6161
62- useEffect ( ( ) => {
63- const unsubscribe = window . electron . ipcRenderer . on ( 'gateway:channel-status' , ( ) => {
64- fetchChannels ( ) ;
65- } ) ;
66- return ( ) => {
67- if ( typeof unsubscribe === 'function' ) {
68- unsubscribe ( ) ;
69- }
70- } ;
71- } , [ fetchChannels ] ) ;
72-
7362 // Fetch configured channel types from config file
7463 const fetchConfiguredTypes = useCallback ( async ( ) => {
7564 try {
@@ -90,6 +79,18 @@ export function Channels() {
9079 void fetchConfiguredTypes ( ) ;
9180 } , [ fetchConfiguredTypes ] ) ;
9281
82+ useEffect ( ( ) => {
83+ const unsubscribe = window . electron . ipcRenderer . on ( 'gateway:channel-status' , ( ) => {
84+ fetchChannels ( ) ;
85+ fetchConfiguredTypes ( ) ;
86+ } ) ;
87+ return ( ) => {
88+ if ( typeof unsubscribe === 'function' ) {
89+ unsubscribe ( ) ;
90+ }
91+ } ;
92+ } , [ fetchChannels , fetchConfiguredTypes ] ) ;
93+
9394 // Get channel types to display
9495 const displayedChannelTypes = showAllChannels ? getAllChannels ( ) : getPrimaryChannels ( ) ;
9596
@@ -205,7 +206,9 @@ export function Channels() {
205206 channel = { channel }
206207 onDelete = { ( ) => {
207208 if ( confirm ( 'Are you sure you want to delete this channel?' ) ) {
208- deleteChannel ( channel . id ) ;
209+ deleteChannel ( channel . id ) . then ( ( ) => {
210+ fetchConfiguredTypes ( ) ;
211+ } ) ;
209212 }
210213 } }
211214 />
You can’t perform that action at this time.
0 commit comments