File tree 1 file changed +5
-2
lines changed
src/webchat/store/messages
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ export const createMessageReducer = (getState: () => { config: ConfigState }) =>
60
60
return [ ...state , newMessage ] ;
61
61
}
62
62
63
- // If message doesn't have text, still add an ID and animationState for enabling the animation
63
+ // If message doesn't have text (e.g. Text with Quick Replies) , still add an ID and animationState for enabling the animation.
64
64
if ( ! newMessage . text ) {
65
65
return [ ...state , {
66
66
...newMessage ,
@@ -88,9 +88,12 @@ export const createMessageReducer = (getState: () => { config: ConfigState }) =>
88
88
89
89
// If no matching message, create new with array
90
90
if ( messageIndex === - 1 ) {
91
+ // break string into chunks on new lines so that markdown is evaluated while a long text is animated
92
+ const textChunks = ( newMessage . text as string ) . split ( / ( \n ) / ) . filter ( chunk => chunk . length > 0 ) ;
93
+
91
94
return [ ...state , {
92
95
...newMessage ,
93
- text : [ newMessage . text as string ] ,
96
+ text : textChunks ,
94
97
id : newMessageId ,
95
98
animationState : "start" ,
96
99
} ] ;
You can’t perform that action at this time.
0 commit comments