Skip to content

Commit c1c8ca1

Browse files
ryan-williamsclaude
andcommitted
fix: pass duration explicitly to setXAxisRange to avoid stale closure
During concurrent updates, the auto-update effect could capture a stale `timeRangeFromProps.duration`, causing range changes to appear to no-op. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b8f9a7e commit c1c8ca1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

www/src/components/AwairChart.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,12 @@ export const AwairChart = memo(function AwairChart(
238238
}, [selectedDeviceIds])
239239

240240
// Handle auto-update from Latest mode hook
241+
// Pass duration explicitly to avoid stale closure issues during concurrent updates
241242
useEffect(() => {
242243
if (autoUpdateRange) {
243-
setXAxisRange(autoUpdateRange)
244+
setXAxisRange(autoUpdateRange, { duration: timeRangeFromProps.duration })
244245
}
245-
}, [autoUpdateRange])
246+
}, [autoUpdateRange, timeRangeFromProps.duration])
246247

247248
// Determine which time range button is active based on the requested duration
248249
const getActiveTimeRange = useCallback(() => {

0 commit comments

Comments
 (0)