fix: model list watch data

This commit is contained in:
jialin
2024-07-15 08:21:06 +08:00
parent 0a0b96735c
commit ec28523daa
17 changed files with 119 additions and 61 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
.editor-wrap {
border-radius: 8px;
border-radius: var(--border-radius-mini);
overflow: hidden;
.editor-header {
+1 -1
View File
@@ -3,7 +3,7 @@
padding: 5px 0 5px 10px;
overflow: auto;
background-color: var(--color-logs-bg);
border-radius: var(--border-radius-small);
border-radius: var(--border-radius-mini);
.content {
word-wrap: break-word;
@@ -1,4 +1,3 @@
import React from 'react';
import '../styles/row-children.less';
const RowChildren = (props: any) => {
@@ -7,4 +6,4 @@ const RowChildren = (props: any) => {
return <div className="row-children">{children}</div>;
};
export default React.memo(RowChildren);
export default RowChildren;
@@ -4,7 +4,7 @@ import { DownOutlined, RightOutlined } from '@ant-design/icons';
import { Button, Checkbox, Col, Empty, Row, Spin } from 'antd';
import classNames from 'classnames';
import _ from 'lodash';
import React, { useEffect, useRef, useState } from 'react';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import RowContext from '../row-context';
import { RowContextProps, SealTableProps } from '../types';
@@ -39,7 +39,8 @@ const TableRow: React.FC<
childrenDataRef.current = childrenData;
console.log('table row====', record.name, firstLoad, expanded);
const { updateChunkedList } = useUpdateChunkedList({
const { updateChunkedList, cacheDataListRef } = useUpdateChunkedList({
dataList: childrenData,
setDataList: setChildrenData
// callback: (list) => renderChildren?.(list)
});
@@ -69,12 +70,13 @@ const TableRow: React.FC<
clearInterval(pollTimer.current);
}
chunkRequestRef.current?.current?.cancel?.();
cacheDataListRef.current = [];
};
}, []);
const renderChildrenData = () => {
const renderChildrenData = useCallback(() => {
return renderChildren?.(childrenData);
};
}, [childrenData]);
const handlePolling = async () => {
if (pollingChildren) {
@@ -91,8 +93,8 @@ const TableRow: React.FC<
console.log('first load=====', firstLoad);
try {
setLoading(true);
const data = await loadChildren?.(record);
setChildrenData(data || []);
// const data = await loadChildren?.(record);
// setChildrenData(data || []);
setLoading(false);
} catch (error) {
setChildrenData([]);
@@ -171,6 +173,7 @@ const TableRow: React.FC<
}
return () => {
chunkRequestRef.current?.current?.cancel?.();
cacheDataListRef.current = [];
};
}, [firstLoad, expanded]);
+3
View File
@@ -38,6 +38,9 @@ export const modalConfig = {
centered: false,
maskClosable: true,
footer: null,
style: {
top: '30%'
},
width: 400
};