sadpandajoe opened a new issue, #44920:
URL: https://github.com/apache/superset/issues/44920
### Bug description
The base width/height/slope/exponent handlers do `const newValue = {
...value }` and then assign into `newValue.configs.<field>`. The spread is
shallow, so `newValue.configs` is the same object as `value.configs`; the
control mutates its prop (which is Redux-held control state) in place before
calling `onChange`. Consumers that compare `configs` by reference, memoised
selectors, and state history/devtools see the change without a new reference.
Steps to reproduce (component level): render with a frozen /
reference-captured `value`, move the "Base width" slider; the original
`value.configs.width` has changed. (Under strict immutability, e.g. a frozen
state object, this throws.)
Expected: `onChange` receives a new `configs` object and the original value
is untouched.
### Where
`superset-frontend/src/explore/components/controls/ZoomConfigControl/ZoomConfigControl.tsx`
- L74-L75 `const newValue = { ...value }; newValue.configs.width = width;`
- same pattern L86-L87 (height), L95-L96 (slope), L105-L106 (exponent)
### Suggested fix
`const newValue = { ...value, configs: { ...value.configs, width } };`
(likewise for the other three).
### Found by
Found while adding React Testing Library coverage for Explore controls (all
line numbers are against `master` at `bc3698b5d6`).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]