Skip to content

Commit 0c6729f

Browse files
authored
fix(ui): undefined reference in providers (#3618)
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.
1 parent 79d61db commit 0c6729f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

ui/pages/providers/[id].js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ export default function ProvidersEditDetails() {
119119
},
120120
]
121121

122-
useEffect(() => {
123-
setName(provider?.name)
124-
}, [provider])
125-
126122
useEffect(() => {
127123
return clearTimer()
128124
}, [])
@@ -298,6 +294,7 @@ export default function ProvidersEditDetails() {
298294
<label className='text-2xs font-medium text-gray-700'>Name</label>
299295
<input
300296
type='search'
297+
placeholder={provider?.name}
301298
value={name}
302299
onKeyDown={e => {
303300
if (e.key === 'Escape' || e.key === 'Esc') {

0 commit comments

Comments
 (0)