@@ -9,7 +9,7 @@ import { setRawState } from 'botframework-webchat-core/internal';
99import { reactNode , validateProps } from 'botframework-webchat-react-valibot' ;
1010import React , { memo , useCallback , useEffect , useMemo , useState } from 'react' ;
1111import { type Action } from 'redux' ;
12- import { object , optional , parse , pipe , readonly , type InferInput } from 'valibot' ;
12+ import { object , optional , pipe , readonly , safeParse , type InferInput } from 'valibot' ;
1313
1414import reduxStoreSchema from '../private/reduxStoreSchema' ;
1515import SuggestedActionsContext , { type SuggestedActionsContextType } from './private/SuggestedActionsContext' ;
@@ -49,12 +49,16 @@ function SuggestedActionsComposer(props: SuggestedActionsComposerProps) {
4949 setOriginActivity ( undefined ) ;
5050 setSuggestedActionsRaw ( EMPTY_ARRAY ) ;
5151 } else if ( action . type === SET_SUGGESTED_ACTIONS ) {
52- const {
53- payload : { originActivity, suggestedActions }
54- } = parse ( setSuggestedActionsActionSchema , action ) ;
52+ const result = safeParse ( setSuggestedActionsActionSchema , action ) ;
5553
56- setOriginActivity ( originActivity ) ;
57- setSuggestedActionsRaw ( Object . freeze ( Array . from ( suggestedActions ) ) ) ;
54+ if ( result . success ) {
55+ const {
56+ payload : { originActivity, suggestedActions }
57+ } = result . output ;
58+
59+ setOriginActivity ( originActivity ) ;
60+ setSuggestedActionsRaw ( Object . freeze ( Array . from ( suggestedActions ) ) ) ;
61+ }
5862 }
5963 } ,
6064 [ setOriginActivity , setSuggestedActionsRaw ]
0 commit comments