formkit / formkit

Vue Forms ⚡️ Supercharged
https://formkit.com
MIT License
4.31k stars 178 forks source link

type=select mutates the values of the provided options #1550

Open strokirk opened 1 week ago

strokirk commented 1 week ago

Reproduction

https://formkit.link/30fcebec478229c1ab944761a8bd3ff7

Describe the bug

Like mentioned in https://github.com/formkit/formkit/issues/357, the select input will replace non-string values with __mask_* (__mask_1, __mask_2, ...) of the provided option list.

This is unexpected, and other parts of the code might rely on the original options object. The docs doesn't mention this either.

A workaround is to manually copy the original options using structuredClone.

Environment

• OS: MacOs • Browser Chrome • Version 1.6.7