Skip to content

Commit

Permalink
actually fix the type error by getting rid of the spread
Browse files Browse the repository at this point in the history
  • Loading branch information
david-crespo committed Oct 5, 2023
1 parent 135783b commit edcf0b0
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions app/components/form/fields/NumberField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { useId } from 'react'
import type { FieldPathByValue, FieldValues } from 'react-hook-form'
import { Controller } from 'react-hook-form'

import type { NumberInputProps as UINumberFieldProps } from '@oxide/ui'
import { FieldLabel, TextInputHint, NumberInput as UINumberField } from '@oxide/ui'
import { capitalize } from '@oxide/util'

Expand Down Expand Up @@ -70,8 +69,7 @@ export const NumberFieldInner = <
description,
required,
id: idProp,
...props
}: TextFieldProps<TFieldValues, TName> & UINumberFieldProps) => {
}: TextFieldProps<TFieldValues, TName>) => {
const generatedId = useId()
const id = idProp || generatedId

Expand All @@ -85,19 +83,17 @@ export const NumberFieldInner = <
<>
<UINumberField
id={id}
title={label}
// title={label}
error={!!error}
aria-labelledby={cn(`${id}-label`, {
[`${id}-help-text`]: !!description,
})}
aria-describedby={description ? `${id}-label-tip` : undefined}
{...fieldRest}
{...props}
// these have to go after the spread so they take precedence
defaultValue={value}
onChange={(val) => {
onChange(val)
}}
{...fieldRest}
/>
<ErrorMessage error={error} label={label} />
</>
Expand Down

0 comments on commit edcf0b0

Please sign in to comment.