Skip to content

Commit

Permalink
chore!: remove subfield
Browse files Browse the repository at this point in the history
  • Loading branch information
crutchcorn committed Feb 25, 2024
1 parent e42f3ab commit 5c4cd9c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 37 deletions.
17 changes: 0 additions & 17 deletions packages/form-core/src/FieldApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,23 +484,6 @@ export class FieldApi<
swapValues = (aIndex: number, bIndex: number) =>
this.form.swapFieldValues(this.name, aIndex, bIndex)

getSubField = <
TSubName extends DeepKeys<TData>,
TSubData extends DeepValue<TData, TSubName> = DeepValue<TData, TSubName>,
>(
name: TSubName,
): FieldApi<
TData,
TSubName,
Validator<TSubData, unknown> | undefined,
Validator<TData, unknown> | undefined,
TSubData
> =>
new FieldApi({
name: `${this.name}.${name}` as never,
form: this.form,
}) as any

validateSync = (value = this.state.value, cause: ValidationCause) => {
const validates = getSyncValidatorArray(cause, this.options)

Expand Down
20 changes: 0 additions & 20 deletions packages/form-core/src/tests/FieldApi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,26 +154,6 @@ describe('field api', () => {
expect(field.getValue()).toStrictEqual(['two', 'one'])
})

it('should get a subfield properly', () => {
const form = new FormApi({
defaultValues: {
names: {
first: 'one',
second: 'two',
},
},
})

const field = new FieldApi({
form,
name: 'names',
})

const subfield = field.getSubField('first')

expect(subfield.getValue()).toBe('one')
})

it('should not throw errors when no meta info is stored on a field and a form re-renders', async () => {
const form = new FormApi({
defaultValues: {
Expand Down

0 comments on commit 5c4cd9c

Please sign in to comment.