Update web/src/controllers/MetricController/MetricViewChart/MetricEditController/MetricStylingApp/StylingAppStyling/EditTrendline/TrendlineOffset.tsx

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
Nate Kelley 2025-05-13 12:27:35 -06:00 committed by GitHub
parent c1750a6816
commit f17760c7c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -12,6 +12,9 @@ interface TrendlineOffsetProps {
export const TrendlineOffset: React.FC<TrendlineOffsetProps> = React.memo(
({ trend, onUpdateExisitingTrendline }) => {
const [value, setValue] = useState(trend.offset ?? 0);
useEffect(() => {
setValue(trend.offset ?? 0);
}, [trend.offset]);
const onChange = useMemoizedFn((value: number[]) => {
onUpdateExisitingTrendline({ ...trend, offset: value[0] });