Fix delete all chats issue
This commit is contained in:
		
							parent
							
								
									6315fc329e
								
							
						
					
					
						commit
						6eea4a98fb
					
				|  | @ -62,11 +62,12 @@ | ||||||
|   let lastSubmitRecorded = false |   let lastSubmitRecorded = false | ||||||
| 
 | 
 | ||||||
|   $: chat = $chatsStorage.find((chat) => chat.id === chatId) as Chat |   $: chat = $chatsStorage.find((chat) => chat.id === chatId) as Chat | ||||||
|   $: chatSettings = chat.settings |   $: chatSettings = chat?.settings | ||||||
|   let showSettingsModal |   let showSettingsModal | ||||||
| 
 | 
 | ||||||
|   let scDelay |   let scDelay | ||||||
|   const onStateChange = (...args:any) => { |   const onStateChange = (...args:any) => { | ||||||
|  |     if (!chat) return | ||||||
|     clearTimeout(scDelay) |     clearTimeout(scDelay) | ||||||
|     setTimeout(() => { |     setTimeout(() => { | ||||||
|       if (chat.startSession) { |       if (chat.startSession) { | ||||||
|  | @ -109,6 +110,7 @@ | ||||||
|   }) |   }) | ||||||
| 
 | 
 | ||||||
|   onMount(async () => { |   onMount(async () => { | ||||||
|  |     if (!chat) return | ||||||
|     // Focus the input on mount |     // Focus the input on mount | ||||||
|     focusInput() |     focusInput() | ||||||
| 
 | 
 | ||||||
|  | @ -585,7 +587,7 @@ | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| </script> | </script> | ||||||
| 
 | {#if chat} | ||||||
| <ChatSettingsModal chatId={chatId} bind:show={showSettingsModal} /> | <ChatSettingsModal chatId={chatId} bind:show={showSettingsModal} /> | ||||||
| 
 | 
 | ||||||
| <div class="chat-content"> | <div class="chat-content"> | ||||||
|  | @ -674,3 +676,4 @@ | ||||||
|     {/each} |     {/each} | ||||||
|   </div> |   </div> | ||||||
| </Footer> | </Footer> | ||||||
|  | {/if} | ||||||
|  | @ -81,6 +81,7 @@ | ||||||
|       confirmButtonClass: 'is-danger', |       confirmButtonClass: 'is-danger', | ||||||
|       confirmButton: 'Delete ALL', |       confirmButton: 'Delete ALL', | ||||||
|       onConfirm: () => { |       onConfirm: () => { | ||||||
|  |         replace('/').then(() => { deleteChat(chatId) }) | ||||||
|         clearChats() |         clearChats() | ||||||
|       } |       } | ||||||
|     }) |     }) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Webifi
						Webifi