Skip to content

Commit b9386c3

Browse files
author
Michael Dijkstra
authored
Merge pull request #85 from calibreapp/fix-stuck-on-open
Fix widget stuck in open state
2 parents 2165ae9 + 6da7039 commit b9386c3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/hooks/useChat.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const useChat = (
7171
const chatProvider = Providers[provider]
7272

7373
const loadChat = useCallback<(args: { open: boolean }) => void>(
74-
({ open = true }) => {
74+
({ open = true } = { open: true }) => {
7575
if (!providerKey) {
7676
//eslint-disable-next-line no-console
7777
console.error('No api key given to react-live-chat-loader')
@@ -88,10 +88,10 @@ const useChat = (
8888

8989
if (open) {
9090
chatProvider.open()
91-
setState('open')
91+
if (state !== 'complete') setState('open')
9292
}
9393
},
94-
[]
94+
[state]
9595
)
9696

9797
return [state, loadChat]

0 commit comments

Comments
 (0)