fix: Some widgets don't seem to beusing meta state resulting in it not holding state in between edit and preview modes (#31970)

Fixes #31881

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
- Renamed `selectedOptionValue` to `selectedValues` in Checkbox and
Switch Group Widgets to more accurately describe its functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro-2.local>
This commit is contained in:
Pawan Kumar 2024-03-21 20:51:16 +05:30 committed by GitHub
parent f60b65b919
commit 031aa63c99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -103,7 +103,7 @@ class WDSCheckboxGroupWidget extends BaseWidget<
};
getWidgetView() {
const { labelTooltip, options, selectedOptionValue, widgetId, ...rest } =
const { labelTooltip, options, selectedValues, widgetId, ...rest } =
this.props;
const validation = validateInput(this.props);
@ -115,7 +115,7 @@ class WDSCheckboxGroupWidget extends BaseWidget<
errorMessage={validation.errorMessage}
onChange={this.onChange}
validationState={validation.validationStatus}
value={selectedOptionValue}
value={selectedValues}
>
{options.map((option, index) => (
<Checkbox key={`${widgetId}-option-${index}`} value={option.value}>

View File

@ -107,7 +107,7 @@ class WDSSwitchGroupWidget extends BaseWidget<
labelPosition,
labelTooltip,
options,
selectedOptionValue,
selectedValues,
widgetId,
...rest
} = this.props;
@ -122,7 +122,7 @@ class WDSSwitchGroupWidget extends BaseWidget<
onChange={this.onChange}
optionsLabelPosition={labelPosition}
validationState={validation.validationStatus}
value={selectedOptionValue}
value={selectedValues}
>
{options.map((option, index) => (
<Switch key={`${widgetId}-option-${index}`} value={option.value}>