Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
wwayne committed May 22, 2024
1 parent e7aa834 commit bc83f4b
Show file tree
Hide file tree
Showing 3 changed files with 221 additions and 17 deletions.
6 changes: 4 additions & 2 deletions clients/tabby-chat-panel/src/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ function useClient(iframeRef: RefObject<HTMLIFrameElement>, api: ClientApi) {
const clientRef = useRef<ServerApi | null>(null)

useEffect(() => {
if (iframeRef.current && !clientRef.current)
if (iframeRef.current && !clientRef.current) {
clientRef.current = createClient(iframeRef.current, api)
}
}, [iframeRef.current])

return clientRef.current
Expand All @@ -20,8 +21,9 @@ function useServer(api: ServerApi) {

useEffect(() => {
const isInIframe = window.self !== window.top
if (isInIframe && !serverRef.current)
if (isInIframe && !serverRef.current) {
serverRef.current = createServer(api)
}
}, [])

return serverRef.current
Expand Down
4 changes: 2 additions & 2 deletions clients/tabby-chat-panel/src/vscode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ function ChatPanel() {
if (iframeRef?.current && token) {
client?.init({
fetcherOptions: {
authorization: token,
},
authorization: token
}
})
}
}, [iframeRef?.current, client, token])
Expand Down
Loading

0 comments on commit bc83f4b

Please sign in to comment.