feat: market event
This commit is contained in:
@@ -1014,11 +1014,12 @@ function CausalFrise({
|
||||
// ── ExplanationScore ──────────────────────────────────────────────────────────
|
||||
|
||||
function ExplanationScore({
|
||||
events, templates, causalInsts,
|
||||
events, templates, causalInsts, onRefreshDone,
|
||||
}: {
|
||||
events: SnapshotEvent[]
|
||||
templates: CausalTemplate[]
|
||||
causalInsts: string[]
|
||||
onRefreshDone?: () => void
|
||||
}) {
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
const [refreshDone, setRefreshDone] = useState(false)
|
||||
@@ -1059,6 +1060,7 @@ function ExplanationScore({
|
||||
try {
|
||||
await api.post('/causal-lab/auto-analyze/refresh')
|
||||
setRefreshDone(true)
|
||||
onRefreshDone?.()
|
||||
setTimeout(() => setRefreshDone(false), 3000)
|
||||
} finally {
|
||||
setRefreshing(false)
|
||||
@@ -1137,16 +1139,8 @@ export default function InstrumentDashboard() {
|
||||
api.get('/causal-lab/templates').then(r => setTemplates(r.data)).catch(() => {})
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const fetchSnapshot = useCallback(() => {
|
||||
setLoading(true)
|
||||
setSnapshot(null)
|
||||
setNarrative('')
|
||||
setSelectedDate(null)
|
||||
setMacroAtDate(null)
|
||||
setTheoryCurve(null)
|
||||
setShowTheory(false)
|
||||
chartDateToXRef.current = null
|
||||
setChartReady(0)
|
||||
api.get(`/instruments/${instrumentId}/snapshot?period=${period}`)
|
||||
.then(r => {
|
||||
setSnapshot(r.data)
|
||||
@@ -1157,6 +1151,18 @@ export default function InstrumentDashboard() {
|
||||
.finally(() => setLoading(false))
|
||||
}, [instrumentId, period])
|
||||
|
||||
useEffect(() => {
|
||||
setSnapshot(null)
|
||||
setNarrative('')
|
||||
setSelectedDate(null)
|
||||
setMacroAtDate(null)
|
||||
setTheoryCurve(null)
|
||||
setShowTheory(false)
|
||||
chartDateToXRef.current = null
|
||||
setChartReady(0)
|
||||
fetchSnapshot()
|
||||
}, [instrumentId, period])
|
||||
|
||||
const loadNarrative = useCallback(() => {
|
||||
setLoadingNarr(true)
|
||||
api.post(`/instruments/${instrumentId}/narrative`)
|
||||
@@ -1525,6 +1531,7 @@ export default function InstrumentDashboard() {
|
||||
events={snapshot.events}
|
||||
templates={templates}
|
||||
causalInsts={causalInsts}
|
||||
onRefreshDone={fetchSnapshot}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user