When changing code component prop from select to multiselect, existing values are still singular

When swapping a Code Component prop from select to multiselect functionality, I ran into a problem where existing versions of the component in question would error out because I was now expecting an array of values, but it was still passing through a single string value. In Studio, the single option is selected in the multi-select, but trying to interact with it causes the error in the screenshot. The only thing to fix was to completely unset and reset the prop. In one case I also had to completely replace the component to get it to update correctly.

image.png

We recommend that code components be written in a backwards-compatible way, as there’s no way in general for Plasmic to know how to migrate your prop data from one version to another, and you may also end up in situations where new code is using old published versions of Plasmic projects. In this case, that would mean CodeComponent would check if the prop value is an array or not, and coerce it into an array before proceeding.