fix: blank Track Record page when the cached backtest report is pre-momentum
Deploy / lint (push) Successful in 6s
Deploy / test (push) Successful in 41s
Deploy / deploy (push) Successful in 24s

The momentum-sweep table read row.min_momentum_percentile.toFixed(), but a report
cached before the EV->momentum change only has min_expected_value rows. undefined
.toFixed() threw during render and — with no error boundary — blanked the whole
Track Record tab. Guard the sweep block on the new field so a stale report just
hides the sweep; re-running the backtest repopulates it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-23 22:47:36 +02:00
parent ef523474ad
commit e71c07e554
@@ -181,7 +181,10 @@ export function BacktestPanel() {
</table>
</div>
{report.sweep && report.sweep.length > 0 && (
{/* Guard on the new field so a stale cached report (pre-momentum,
with min_expected_value rows) hides the sweep instead of crashing
the whole page. Re-running the backtest repopulates it. */}
{report.sweep && report.sweep.length > 0 && report.sweep[0].min_momentum_percentile != null && (
<div>
<p className="mb-2 text-xs font-medium uppercase tracking-widest text-gray-500">
Momentum-percentile sweep