Merge pull request #1512 from riccardobl/clearbug

Fix some issues in clear button for input fields
This commit is contained in:
Keyan 2024-11-02 16:45:33 -05:00 committed by GitHub
commit a253e42829
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -33,6 +33,7 @@ import EyeClose from '@/svgs/eye-close-line.svg'
import Info from './info'
import { useMe } from './me'
import classNames from 'classnames'
import { useIsClient } from './use-client'
export class SessionRequiredError extends Error {
constructor () {
@ -455,6 +456,7 @@ function InputInner ({
const [field, meta, helpers] = noForm ? [{}, {}, {}] : useField(props)
const formik = noForm ? null : useFormikContext()
const storageKeyPrefix = useContext(StorageKeyPrefixContext)
const isClient = useIsClient()
const storageKey = storageKeyPrefix ? storageKeyPrefix + '-' + props.name : undefined
@ -538,7 +540,7 @@ function InputInner ({
isInvalid={invalid}
isValid={showValid && meta.initialValue !== meta.value && meta.touched && !meta.error}
/>
{(clear && field.value) &&
{(isClient && clear && field.value && !props.readOnly) &&
<Button
variant={null}
onClick={(e) => {