fix(client): why the hell are there two setComments

i reckon it's something to do with pbs not having comments but like.
why the hell did i make this?
This commit is contained in:
zkldi
2022-07-25 22:06:05 +01:00
parent f0a02fecae
commit 9b0e336a12
2 changed files with 16 additions and 2 deletions
@@ -556,7 +556,12 @@ function PseudHighlight({
/>
) : (
<span className="breakdown-hover-highlight-button">
<Icon onClick={() => setHighlight(true)} type="star" regular noPad />
<Icon
onClick={() => setHighlight(true)}
type="star"
regular
style={{ paddingTop: "0.1rem" }}
/>
</span>
)}
</td>
@@ -66,7 +66,11 @@ export default function DocumentComponent({
chart,
}: {
score: ScoreDocument | PBScoreDocument;
scoreState: { highlight: boolean; setHighlight: SetState<boolean> };
scoreState: {
highlight: boolean;
setHighlight: SetState<boolean>;
setComment?: SetState<string | null>;
};
renderScoreInfo?: boolean;
showSingleScoreNote?: boolean;
pbData: UGPTChartPBComposition;
@@ -88,6 +92,11 @@ export default function DocumentComponent({
setComment(IsScore(score) ? score.comment : null);
}, [score]);
useEffect(() => {
// what kind of crack was i smoking here?
scoreState.setComment?.(comment);
}, [comment]);
return (
<>
<div className="col-9">