-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avoid duplicate message fetching and rendering.
Prevents duplicate error messages from being fetched on the initial load. Does not fetch initial message for the chat pop up if the popup is hidden TEST=manual ran locally, verified this functionality. Change-Id: Idca1a37622ccc6a362681a8c4f9f7c9994f9fa58
- Loading branch information
Showing
11 changed files
with
57 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@yext/chat-ui-react](./chat-ui-react.md) > [ChatPanelProps](./chat-ui-react.chatpanelprops.md) > [isChatHidden](./chat-ui-react.chatpanelprops.ischathidden.md) | ||
|
||
## ChatPanelProps.isChatHidden property | ||
|
||
If chat is hidden, the initial message will not be fetched. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
isChatHidden?: boolean; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@yext/chat-ui-react", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"description": "A library of React Components for powering Yext Chat integrations.", | ||
"author": "[email protected]", | ||
"main": "./lib/commonjs/src/index.js", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import { MessageSource, useChatActions } from "@yext/chat-headless-react"; | ||
import { ChatHeadless, MessageSource } from "@yext/chat-headless-react"; | ||
import { useCallback } from "react"; | ||
|
||
/** | ||
* Returns a default handler function for API errors. It will log the error and | ||
* add a default error message to state. | ||
* | ||
* @internal | ||
* | ||
* @param chatHeadless - {@link ChatHeadless} | ||
*/ | ||
export function useDefaultHandleApiError() { | ||
const chat = useChatActions(); | ||
|
||
export function useDefaultHandleApiError(chatHeadless: ChatHeadless) { | ||
return useCallback( | ||
(e: unknown) => { | ||
console.error(e); | ||
chat.addMessage({ | ||
chatHeadless.addMessage({ | ||
text: "Sorry, I'm unable to respond at the moment. Please try again later!", | ||
source: MessageSource.BOT, | ||
timestamp: new Date().toISOString(), | ||
}); | ||
}, | ||
[chat] | ||
[chatHeadless] | ||
); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters