From 0842c40dc11803bc92d5fc5a875bf59ff0481742 Mon Sep 17 00:00:00 2001 From: gtarpenning Date: Tue, 29 Oct 2024 11:57:34 -0700 Subject: [PATCH] only edit users feedback --- .../feedback/HumanFeedback/HumanFeedback.tsx | 26 +++---------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/HumanFeedback/HumanFeedback.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/HumanFeedback/HumanFeedback.tsx index 6d828eff063..9411236fbe2 100644 --- a/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/HumanFeedback/HumanFeedback.tsx +++ b/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/HumanFeedback/HumanFeedback.tsx @@ -209,10 +209,8 @@ export const HumanFeedbackCell: React.FC< [feedback.creator ?? '']: feedback.payload.value, ...acc, }; - }, {}); + }, {}) as Record>>; - console.log('combinedFeedback', combinedFeedback); - // rawValues is an array of values from the feedback const parsedRef = parseRef(props.sfData.ref); @@ -223,10 +221,9 @@ export const HumanFeedbackCell: React.FC< values.push(pRecord[parsedRef.artifactName]?.[parsedRef.artifactVersion]); } return values; - }, [combinedFeedback, parsedRef]) - - console.log('rawValues', rawValues); + }, [combinedFeedback, parsedRef]); + const viewerFeedbackVal = props.viewer ? combinedFeedback[props.viewer]?.[parsedRef.artifactName]?.[parsedRef.artifactVersion] : null; if (query?.loading) { return ; @@ -239,24 +236,9 @@ export const HumanFeedbackCell: React.FC< ; } - // TODO: fix, we want only one callsite for renderFeedbackComponent - if (Object.keys(combinedFeedback).length === 0) { - return
- {renderFeedbackComponent(props, onAddFeedback, null)} -
; - } - return (
- {rawValues?.map(val => renderFeedbackComponent(props, onAddFeedback, val))} - {/* {Object.entries(combinedFeedback) - .map(([userId, value]) => { - return renderFeedbackComponent( - props, - onAddFeedback, - value[0]?.[parsedRef.artifactName]?.[parsedRef.artifactVersion] - ) - })} */} + {renderFeedbackComponent(props, onAddFeedback, viewerFeedbackVal)}
); };