Skip to content

Commit

Permalink
fix: 属性面板重复渲染问题 (#134)
Browse files Browse the repository at this point in the history
* fix: 表格、图表tab切换渲染问题

* fix: 更新问题

---------

Co-authored-by: yxh01132861 <[email protected]>
  • Loading branch information
simplexiao and yxh01132861 authored Jan 31, 2024
1 parent 9d9ac5f commit 9d9af0a
Showing 1 changed file with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Dataset, ImplementWidget, WidgetSchema } from '@antv/li-sdk';
import classNames from 'classnames';
import { forOwn, omit } from 'lodash-es';
import React, { useCallback, useMemo } from 'react';
import React, { useCallback, useEffect, useMemo } from 'react';
import { AtomWidgetEmptyContainer } from '../../../constants';
import { useEditorDatasets, useEditorService, useEditorState } from '../../../hooks';
import { useWidgets } from './useWidgets';
Expand Down Expand Up @@ -38,24 +38,26 @@ const WidgetAttribute: React.FC<WidgetAttributeProps> = (props) => {

// 数据集列表
const { editorDatasets } = useEditorDatasets();
const datasets: Dataset[] = editorDatasets.map((item) => {
const columns = item.columns.map((cloumn) => {
// TODO: 从 editorDataset 获取 domain 数据
let domain: string[] | [number, number] = [];
if (cloumn.type === 'string') {
const itemValue = item.data.map((_item: any) => _item[cloumn.name]);
domain = cloumn.type === 'string' ? [...new Set(itemValue)] : [];
}
const datasets: Dataset[] = useMemo(() => {
return editorDatasets.map((item) => {
const columns = item.columns.map((cloumn) => {
// TODO: 从 editorDataset 获取 domain 数据
let domain: string[] | [number, number] = [];
if (cloumn.type === 'string') {
const itemValue = item.data.map((_item: any) => _item[cloumn.name]);
domain = cloumn.type === 'string' ? [...new Set(itemValue)] : [];
}

return { ...cloumn, domain };
});
return { ...cloumn, domain };
});

return {
...item.schema,
columns: columns,
data: [],
};
});
return {
...item.schema,
columns: columns,
data: [],
};
});
}, [editorDatasets]);

// 服务资产列表
const services = useMemo(() => appService.getImplementServices(), [appService]);
Expand Down

0 comments on commit 9d9af0a

Please sign in to comment.