Files
auto-stock/frontend/src/main.tsx
shuim e2d4b607cb fix: 예수금 음수 표시 + 배포 후 화면이 영구 정지하던 문제
- 예수금: dnca_tot_amt(D+2 기준)를 먼저 읽어 당일 매수가 많으면 -913,965원처럼 음수가
  표시됐다. 주문가능현금(_ord_psbl_cash) → prvs_rcdl_excc_amt → nxdy_excc_amt 순으로
  첫 양수를 사용한다(데이트레이딩 엔진과 동일 기준).
- 프론트: /auth/me 가 한 번 실패하면(배포 중 502) useTenantMode.mode 가 undefined 로 남아
  포트폴리오·매매 쿼리가 전부 enabled:false 로 멈췄다(오늘 26분간 API 호출 0건 확인).
  auth-me 를 실패 시 10초 간격 재시도로 바꾸고, queryClient 기본값에 retry 3회/백오프,
  refetchOnReconnect, networkMode:'always' 를 적용해 백엔드 복구 시 자동으로 되살아나게 함.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-23 11:15:48 +09:00

39 lines
1.3 KiB
TypeScript

import React from 'react'
import ReactDOM from 'react-dom/client'
import { BrowserRouter } from 'react-router-dom'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import App from './App'
import './index.css'
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
// 배포(1~2분 다운) 후에도 화면이 스스로 살아나도록:
// - 재시도 3회(지수 백오프, 최대 10초)
// - 네트워크 복구 시 자동 재조회
// - 오프라인 판단으로 쿼리가 멈추지 않도록 항상 실행
retry: 3,
retryDelay: (attempt) => Math.min(1000 * 2 ** attempt, 10000),
refetchOnReconnect: true,
networkMode: 'always',
},
mutations: { networkMode: 'always' },
},
})
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<BrowserRouter
future={{
v7_startTransition: true,
v7_relativeSplatPath: true,
}}
>
<App />
</BrowserRouter>
</QueryClientProvider>
</React.StrictMode>,
)