테블릿 로딩 이슈 수정

This commit is contained in:
Macbook
2026-05-31 23:44:31 +09:00
parent a34b49c23a
commit 332019866a
7 changed files with 78 additions and 15 deletions
+4 -1
View File
@@ -46,6 +46,8 @@ export interface RightSidePanelProps {
paperTradingEnabled?: boolean;
paperAutoTradeEnabled?: boolean;
onPaperOrderFilled?: () => void;
/** 차트 화면·업비트 종목일 때만 체결 WS/REST */
wsFeedEnabled?: boolean;
}
const RightSidePanel: React.FC<RightSidePanelProps> = ({
@@ -74,6 +76,7 @@ const RightSidePanel: React.FC<RightSidePanelProps> = ({
paperTradingEnabled = false,
paperAutoTradeEnabled = false,
onPaperOrderFilled,
wsFeedEnabled = true,
}) => {
const [openInternal, setOpenInternal] = useState(false);
const [tabInternal, setTabInternal] = useState<TradeRightPanelTab>('trade');
@@ -81,7 +84,7 @@ const RightSidePanel: React.FC<RightSidePanelProps> = ({
const isOpenControlled = openControlled !== undefined && onOpenChange !== undefined;
const open = isOpenControlled ? !!openControlled : openInternal;
const { trades: recentTrades, strength: tradeStrength } = useUpbitRecentTrades(market, open);
const { trades: recentTrades, strength: tradeStrength } = useUpbitRecentTrades(market, open && wsFeedEnabled);
const setOpen = (next: boolean | ((p: boolean) => boolean)) => {
const cur = isOpenControlled ? !!openControlled : openInternal;
const value = typeof next === 'function' ? next(cur) : next;
@@ -5,7 +5,7 @@ import React, { useState, useCallback, useEffect, useMemo, useRef } from 'react'
import { ReactFlowProvider } from '@xyflow/react';
import DraggableModalFrame from './DraggableModalFrame';
import type { Theme } from '../types/index';
import { loadStrategies, loadStrategy, saveStrategy, deleteStrategy, type StrategyDto as ApiStrategyDto } from '../utils/backendApi';
import { hasRegisteredUser, loadStrategies, loadStrategy, saveStrategy, deleteStrategy, type StrategyDto as ApiStrategyDto } from '../utils/backendApi';
import { syncStrategyTimeframesFromLayoutIfNeeded } from '../utils/strategyTimeframeSync';
import type { LogicNode } from '../utils/strategyTypes';
import {
@@ -512,6 +512,7 @@ export default function StrategyEditorPage({ theme }: Props) {
useEffect(() => { saveStratsLocal(strategies); }, [strategies]);
useEffect(() => {
if (!hasRegisteredUser()) return;
loadStrategies().then(async list => {
if (list?.length) {
setStrategies(list.map(s => ({
@@ -647,6 +648,9 @@ export default function StrategyEditorPage({ theme }: Props) {
// flow layout START 분봉이 DB DSL보다 최신이면 서버에 반영 (실시간 평가는 DB 기준)
void (async () => {
if (!hasRegisteredUser() || s.id == null) return;
const exists = await loadStrategy(s.id);
if (!exists) return;
const synced = await syncStrategyTimeframesFromLayoutIfNeeded(s.id, { ...s, flowLayout: stored ?? s.flowLayout });
if (!synced) return;
try {