This commit is contained in:
Macbook
2026-06-18 00:56:50 +09:00
parent e5b5af093e
commit ac55748aec
7 changed files with 254 additions and 7 deletions
@@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useState } from 'react';
import React, { useCallback, useEffect, useRef, useState } from 'react';
export const COMBO_FIELD_CUSTOM = '__field_custom__';
@@ -117,6 +117,22 @@ export default function ComboFieldSelect({
setDraft(String(clamped));
}, [draft, allowDecimal, min, max, onCustomNumberChange, customNumber]);
const commitRef = useRef(commitCustom);
commitRef.current = commitCustom;
// 직접입력 blur 전 탭 전환·저장 시 값 유실 방지
useEffect(() => () => { commitRef.current(); }, []);
useEffect(() => {
if (!focused || mode !== 'custom') return;
const parsed = parseDraft(draft, allowDecimal);
if (parsed == null) return;
const clamped = clampValue(parsed, min, max, allowDecimal);
if (clamped === customNumber) return;
const t = window.setTimeout(() => onCustomNumberChange(clamped), 400);
return () => window.clearTimeout(t);
}, [draft, focused, mode, allowDecimal, min, max, customNumber, onCustomNumberChange]);
return (
<div className={`se-combo-field${mode === 'custom' ? ' se-combo-field--custom-only' : ''}`}>
<select
@@ -382,7 +382,7 @@ const StrategyEvaluationChart: React.FC<Props> = ({
}
void runSignalScanForBars(bars);
return () => { ++backtestGenRef.current; };
}, [strategy?.id, market, timeframe, paramsRevision, bars, loading, runSignalScanForBars]);
}, [strategy?.id, strategy?.buyCondition, market, timeframe, paramsRevision, bars, loading, runSignalScanForBars]);
useEffect(() => {
applyMarkers();