fix(market): 修复组件数据初始化时的空值错误

master
钟良源 2 months ago
parent 819ef713a5
commit 3a3333c40e

@ -393,7 +393,7 @@ const Market: React.FC<MarketProps> = ({ updateProjectComp }) => {
const addInitState = (componentData) => {
// 当前工程下已添加的组件ID列表
const projectComponent = projectComponentData[info.id];
const compListByProject = projectComponent.compIds.concat(projectComponent.flowIds);
const compListByProject = projectComponent ? projectComponent.compIds.concat(projectComponent.flowIds) : [];
const objectKeys = Object.keys(componentData);
/*
* :
@ -402,12 +402,12 @@ const Market: React.FC<MarketProps> = ({ updateProjectComp }) => {
* */
objectKeys.forEach(key => {
if (key === 'pubFlow' || key === 'myFlow') {
componentData[key].forEach(item => {
componentData[key] && componentData[key].forEach(item => {
item.isAdd = compListByProject.includes(item.id);
});
}
else if (key === 'myLibs' || key === 'pubLibs' || key === 'teamLibs') {
componentData[key].length && componentData[key].forEach(item => {
componentData[key] && componentData[key].forEach(item => {
item.children.forEach(v => {
v.isAdd = compListByProject.includes(v.comp.id);
});

Loading…
Cancel
Save