Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Clutch
Commits
4a9c159e
Commit
4a9c159e
authored
3 years ago
by
Daniel Hochman
Browse files
Options
Download
Email Patches
Plain Diff
defensive
parent
e0bcddb6
hooks-first-in-select
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/packages/core/src/Input/select.tsx
+3
-1
frontend/packages/core/src/Input/select.tsx
with
3 additions
and
1 deletion
+3
-1
frontend/packages/core/src/Input/select.tsx
+
3
-
1
View file @
4a9c159e
...
...
@@ -205,7 +205,9 @@ const Select = ({
const
defaultIdx
=
defaultOption
<
optionLength
?
defaultOption
:
0
;
const
[
selectedIdx
,
setSelectedIdx
]
=
React
.
useState
(
defaultIdx
);
React
.
useEffect
(()
=>
{
optionLength
>
0
&&
onChange
&&
onChange
(
options
[
selectedIdx
]?.
value
||
options
[
selectedIdx
].
label
);
optionLength
>
0
&&
onChange
&&
onChange
(
options
[
selectedIdx
]?.
value
||
options
[
selectedIdx
].
label
);
},
[
options
]);
if
(
optionLength
===
0
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help