Skip to content

Commit

Permalink
fix(ui): undefined reference in providers (#3618)
Browse files Browse the repository at this point in the history
under specific conditions, the provider details page will throw an
uncaught exception caused by `useEffect` setting `name` to undefined
when provider is undefined.

use a placeholder instead of setting the field value directly. this also
fixes the issue where an empty value is seens as a change, enabling
save.
  • Loading branch information
mxyng authored Nov 11, 2022
1 parent 79d61db commit 0c6729f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions ui/pages/providers/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ export default function ProvidersEditDetails() {
},
]

useEffect(() => {
setName(provider?.name)
}, [provider])

useEffect(() => {
return clearTimer()
}, [])
Expand Down Expand Up @@ -298,6 +294,7 @@ export default function ProvidersEditDetails() {
<label className='text-2xs font-medium text-gray-700'>Name</label>
<input
type='search'
placeholder={provider?.name}
value={name}
onKeyDown={e => {
if (e.key === 'Escape' || e.key === 'Esc') {
Expand Down

0 comments on commit 0c6729f

Please sign in to comment.