@@ -33,22 +33,20 @@ const parseActivity = (entities?: WebChatActivity['entities']) => {
3333 return { graph, messageThing } ;
3434} ;
3535
36- const useGetMessageThing = ( activity : WebChatActivity ) =>
37- useMemo ( ( ) => {
38- const { messageThing, graph } = parseActivity ( activity . entities ) ;
39- if ( hasFeedbackLoop ( activity ) ) {
40- return { isFeedbackLoopSupported : true , ...parseActivity ( [ defaultFeedbackEntities ] ) } ;
41- }
42- return { isFeedbackLoopSupported : false , messageThing, graph } ;
43- } , [ activity ] ) ;
44-
4536function ActivityFeedback ( { activity } : ActivityFeedbackProps ) {
4637 const [ { feedbackActionsPlacement } ] = useStyleOptions ( ) ;
4738 const rootClassName = useStyleToEmotionObject ( ) ( ROOT_STYLE ) + '' ;
4839
4940 const [ selectedAction , setSelectedAction ] = useState < OrgSchemaAction | undefined > ( ) ;
5041
51- const { messageThing, graph, isFeedbackLoopSupported } = useGetMessageThing ( activity ) ;
42+ const isFeedbackLoopSupported = hasFeedbackLoop ( activity ) ;
43+
44+ const { messageThing, graph } = useMemo ( ( ) => {
45+ if ( isFeedbackLoopSupported ) {
46+ return parseActivity ( [ defaultFeedbackEntities ] ) ;
47+ }
48+ return parseActivity ( activity . entities ) ;
49+ } , [ activity . entities , isFeedbackLoopSupported ] ) ;
5250
5351 const feedbackActions = useMemo < ReadonlySet < OrgSchemaAction > > ( ( ) => {
5452 try {
0 commit comments