When using the Menu component from Ant Design you are able to set an “On select” interaction.
Alongside the page-level variables available, there is a component-level variable named key
that obviously should point to the selected menu key.
Using the code editor, the autocomplete shows that the key
type is string
and its inspected value is Symbol(plasmic.string)
.
However, if you try to use this variable to set another state you should end up with an error:
This occurs because, at the runtime, the type of the key
variable is object
.
I found this after I unsuccessfully tried to inspect the variable using a JSON.stringify(key)
, which caused a circular reference error.
After I change my inspection to an Object.keys(key)
I figured out that the variable key
is like an event context - not the key itself - and it has the following fields:
For those who are struggling with this issue like the #8740, just use key.key
or key.keyPath
to really get the key value.
This issue should be fixed, so that’s why I opened it.