studio
studio copied to clipboard
[Dashboard] SetVariable action will cause the original variable to be modified
Describe the bug
struct TREE_NODE:
{
key: string,
title: string,
info: string
}
originalData and treeData are array:struct:TREE_NODE
Use variable originalData to initialize treeData with SetVairable action.
When the button is clicked, the info field of treeData is modified, and the info field of originalData is modified too.
Expected behavior
originalData need remain unchanged.
Screenshots
before clicking button:
after clicking button:
Desktop (please complete the following information):
- OS: win10
- eez-studio v0.13.0
You need to use Array.clone(originalData) in SetVariable to make a deep clone of originalData.
If Array.clone is not used then both treeData and originalData variables points to the same data.