fix: query selector set sys value problem

This commit is contained in:
Joel 2024-04-01 16:49:16 +08:00
parent d0509213d1
commit 74ead43ae1
2 changed files with 7 additions and 2 deletions

View File

@ -88,7 +88,7 @@ const VarReferencePicker: FC<Props> = ({
return getNodeInfoById(availableNodes, outputVarNodeId)?.data
})()
const varName = hasValue ? value[value.length - 1] : ''
const varName = hasValue ? `${isSystemVar(value as ValueSelector) ? 'sys.' : ''}${value[value.length - 1]}` : ''
const getVarType = () => {
if (isConstant)

View File

@ -76,7 +76,12 @@ const Item: FC<ItemProps> = ({
}, [isHovering])
const handleChosen = (e: React.MouseEvent) => {
e.stopPropagation()
onChange([nodeId, ...objPath, itemData.variable], itemData)
if (itemData.variable.startsWith('sys.')) { // system variable
onChange([...objPath, ...itemData.variable.split('.')], itemData)
}
else {
onChange([nodeId, ...objPath, itemData.variable], itemData)
}
}
return (
<PortalToFollowElem