fix: upload a image can clear other message

This commit is contained in:
jialin
2024-10-17 16:06:38 +08:00
parent fbefb2014d
commit e10c5e28b5
12 changed files with 505 additions and 17 deletions
+10 -3
View File
@@ -4,7 +4,14 @@ import { Terminal } from '@xterm/xterm';
import '@xterm/xterm/css/xterm.css';
import classNames from 'classnames';
import _ from 'lodash';
import { memo, useCallback, useEffect, useRef, useState } from 'react';
import {
memo,
useCallback,
useEffect,
useLayoutEffect,
useRef,
useState
} from 'react';
import './index.less';
import useSize from './use-size';
@@ -22,7 +29,7 @@ const LogsViewer: React.FC<LogsViewerProps> = (props) => {
const termRef = useRef<any>({});
const termwrapRef = useRef<any>({});
const fitAddonRef = useRef<any>({});
const cacheDataRef = useRef<any>(null);
const cacheDataRef = useRef<any>('');
const [logs, setLogs] = useState('');
const size = useSize(scroller);
@@ -99,7 +106,7 @@ const LogsViewer: React.FC<LogsViewerProps> = (props) => {
};
}, [termwrapRef.current]);
useEffect(() => {
useLayoutEffect(() => {
if (size) {
handleResize();
}