diff --git a/openspec/changes/code-review-fix/tasks.md b/openspec/changes/code-review-fix/tasks.md index ec2d8e6..950ed97 100644 --- a/openspec/changes/code-review-fix/tasks.md +++ b/openspec/changes/code-review-fix/tasks.md @@ -37,7 +37,7 @@ - [x] 4.9 `[haiku]` Add `parseInt(value, 10)` with `isNaN()` guard to all routes parsing integer query params - [x] 4.10 `[sonnet]` Add CSV injection protection (prefix `=+@-` cells with `'`) to all export routes - [x] 4.11 `[sonnet]` Add `response.ok` checks before `.json()` in `src/app/page.tsx` (lines 214, 230, 245, 257) -- [ ] 4.12 `[sonnet]` Add `response.ok` checks before `.json()` in `src/components/CandleChart.tsx` (lines 163, 178, 192) +- [x] 4.12 `[sonnet]` Add `response.ok` checks before `.json()` in `src/components/CandleChart.tsx` (lines 163, 178, 192) ## 5. ML Service Hardening (Python) diff --git a/src/components/CandleChart.tsx b/src/components/CandleChart.tsx index cb6a8c3..ba3336b 100644 --- a/src/components/CandleChart.tsx +++ b/src/components/CandleChart.tsx @@ -161,6 +161,7 @@ const CandleChart = forwardRef( try { const url = activeChartId ? `/api/candles?chartId=${activeChartId}` : '/api/candles'; const response = await fetch(url); + if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`); const data = await response.json(); setCandles(data); setIsEmpty(data.length === 0); @@ -176,6 +177,7 @@ const CandleChart = forwardRef( try { const url = activeChartId ? `/api/annotations?chartId=${activeChartId}` : '/api/annotations'; const response = await fetch(url); + if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`); const data = await response.json(); setAnnotations(data); return data; @@ -189,6 +191,7 @@ const CandleChart = forwardRef( const fetchAnnotationTypes = async () => { try { const response = await fetch('/api/annotation-types'); + if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`); const data = await response.json(); setAnnotationTypes(data.filter((t: AnnotationType) => t.is_active)); return data;