Skip to content

Commit

Permalink
SHARED(Frontend): Fix broken native select components
Browse files Browse the repository at this point in the history
  • Loading branch information
pkoivisto committed Oct 7, 2024
1 parent edf928b commit 9be24ea
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions frontend/packages/shared/CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Released]

## [1.11.4] - 2024-10-07

### Fixed
- Fixed bug introduced in v.1.11.1: NativeSelect and NativeSelectWithLabel didn't display chosen value correctly

## [1.11.3] - 2024-09-18

### Added
Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opetushallitus/kieli-ja-kaantajatutkinnot.shared",
"version": "1.11.3",
"version": "1.11.4",
"description": "Shared Frontend Package",
"exports": {
"./components": "./src/components/index.tsx",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const NativeSelectOrComboBox = ({
values,
helperText,
showError,
value: rest.value || '',
value: rest.value || undefined,
disabled: rest.disabled,
'data-testid': rest['data-testid'],
variant: 'outlined',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const LanguageSelect = ({
const nativeSelectProps: CustomNativeSelectProps = {
placeholder: rest.label || '',
values: sortedOptions,
value: value || '',
value: value || undefined,
helperText,
showError,
'data-testid': rest['data-testid'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import { ComboBoxOption } from '../../interfaces';
import { Text } from '../Text/Text';

export interface CustomNativeSelectProps
extends BaseSelectProps<ComboBoxOption> {
extends Omit<BaseSelectProps<string>, 'value'> {
'data-testid'?: string;
helperText?: string;
showError?: boolean;
placeholder: string;
value: '' | ComboBoxOption | undefined;
value: ComboBoxOption | undefined;
values: Array<ComboBoxOption>;
}

Expand All @@ -27,7 +27,7 @@ const CustomSelect = ({
...rest
}: CustomNativeSelectProps) => {
const options = [{ label: placeholder, value: '' }, ...values];
const inputValue = value && value.value ? value : '';
const inputValue = value && value.value ? value.value : '';

return (
<Select variant={Variant.Outlined} value={inputValue} {...rest} native>
Expand Down

0 comments on commit 9be24ea

Please sign in to comment.