Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: basePropsGroup use deepclone prevent clone array itself #975

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions packages/plugins/materials/src/composable/useMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
import meta from '../../meta'
import { getBlockCompileRes, getBlockByName, updateBlockCompileCache } from './block-compile'

const { camelize, capitalize } = utils
const { camelize, capitalize, deepClone } = utils
const { MATERIAL_TYPE } = constants

// 这里存放所有TinyVue组件、原生HTML、内置组件的缓存,包含了物料插件面板里所有显示的组件,也包含了没显示的一些联动组件
Expand Down Expand Up @@ -113,13 +113,17 @@ const patchBaseProps = (schemaProperties) => {
})

if (group) {
const targetInsertContent = basePropGroup.content.filter(
(item) => !group.content.some((prop) => prop.property === item.property)
)

if (insertPosition === 'start') {
group.content.splice(0, 0, ...basePropGroup.content)
group.content.splice(0, 0, ...deepClone(targetInsertContent))
} else {
group.content.push(...basePropGroup.content)
group.content.push(...deepClone(targetInsertContent))
}
} else {
schemaProperties.push(basePropGroup)
schemaProperties.push(deepClone(basePropGroup))
}
}
}
Expand Down
Loading