Skip to content
This repository was archived by the owner on Mar 9, 2023. It is now read-only.

Commit 733e3a8

Browse files
authored
Merge pull request #85 from ljmotta/quick-fix-select
Fix SelectField
2 parents d7db584 + bde3744 commit 733e3a8

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

examples/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"uniforms-bridge-json-schema": "3.5.1",
2020
"uniforms-bridge-simple-schema": "3.5.1",
2121
"uniforms-bridge-simple-schema-2": "3.5.1",
22-
"uniforms-patternfly": "4.6.0"
22+
"uniforms-patternfly": "4.6.1"
2323
},
2424
"devDependencies": {
2525
"parcel-bundler": "^1.12.5",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "uniforms-patternfly",
3-
"version": "4.6.0",
3+
"version": "4.6.1",
44
"description": "Patternfly forms for uniforms",
55
"repository": "[email protected]:aerogear/uniforms-patternfly.git",
66
"author": "Gianluca <[email protected]>",

src/SelectField.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,16 @@ function SelectField(props: SelectFieldProps) {
171171
[props]
172172
);
173173

174-
if (props.placeholder)
175-
selectedOptions.unshift(
176-
<SelectOption
177-
key={props.allowedValues!.length}
178-
isPlaceholder
179-
value={props.placeholder}
180-
/>
181-
);
174+
useEffect(() => {
175+
if (props.placeholder)
176+
selectedOptions.unshift(
177+
<SelectOption
178+
key={props.allowedValues!.length}
179+
isPlaceholder
180+
value={props.placeholder}
181+
/>
182+
);
183+
}, [props.placeholder, selectedOptions])
182184

183185
return wrapField(
184186
props,

0 commit comments

Comments
 (0)