Superfluous value copies inside plugin options
- Dominant language
- JavaScript
- Stars
- 67.7k
- Forks
- 11.9k
- Avg merge
- 7h 39m
- Merged PRs (30d)
- 5
Description
### Expected behavior
Options set for a plugin should be received as they are by the plugin.
### Current behavior
When the plugin options value has a given structure (e.g. a property contains an array of objects), some values seem to be copied from the options itself into its parts.
In the example that I provide, the passed options value is:
```js
{
some_array_of_objects: [{ prop: 1 }, { prop: 2 }]
}
```
But the received value in the plugin lifecycle callbacks is:
```js
{
"some_array_of_objects": [
{
"prop": 1,
"0": {
"prop": 1
},
"1": {
"prop": 2
}
},
{
"prop": 2,
"0": {
"prop": 1
},
"1": {
"prop": 2
}
}
]
}
```
### Reproducible sample
https://codepen.io/aeqz/pen/rNQRgaw
### Optional extra steps/info to reproduce
_No response_
### Possible solution
_No response_
### Context
I noticed that my site performance was degrading exponentially with each interaction with a chart that used a custom plugin.
One of the plugin options, which consisted of an array of ranges selected by the user, was being sent back through a callback when the user interacted with the chart in order to modify its selection, and received again as an options value, which is how usually input elements work in React. Due to the behaviour that I'm reporting, this interaction cycle was producing an exponential growth of undesired copied data within the options value.
### chart.js version
v4.3.3
### Browser name and version
_No response_
### Link to your project
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.