Skip to content

Commit 00b160b

Browse files
committed
fix: read undefined when editing APIKey
1 parent c6fe01a commit 00b160b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/components/ui/SettingsApiKey.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { createSignal } from 'solid-js'
2+
import { Show } from 'solid-js/web'
23
import { useClipboardCopy } from '@/hooks'
34
import SettingsNotDefined from './SettingsNotDefined'
45
import type { Accessor } from 'solid-js'
@@ -21,13 +22,15 @@ export default ({ settings, editing, value, setValue }: Props) => {
2122
<div class="fcc relative border border-base focus-within:border-base-100 transition-colors-200">
2223
<input
2324
type={isOpen() ? 'text' : 'password'}
24-
value={value()}
25+
value={value() || ''}
2526
class="w-full mt-1 bg-transparent pl-2 py-1 pr-8 input-base focus:border-base-100"
2627
onChange={e => setValue(e.currentTarget.value)}
2728
/>
28-
<div class="absolute top-0 right-0 bottom-0 fcc p-1 w-8 box-border bg-transparent cursor-pointer" onClick={() => { setIsOpen(!isOpen()) }}>
29-
<div class={`${isOpen() ? 'i-carbon-view' : 'i-carbon-view-off'} text-sm`} />
30-
</div>
29+
<Show when={value()}>
30+
<div class="absolute top-0 right-0 bottom-0 fcc p-1 w-8 box-border bg-transparent cursor-pointer" onClick={() => { setIsOpen(!isOpen()) }}>
31+
<div class={`${isOpen() ? 'i-carbon-view' : 'i-carbon-view-off'} text-sm`} />
32+
</div>
33+
</Show>
3134
</div>
3235
)}
3336
{!editing() && value() && (

0 commit comments

Comments
 (0)