-
-
Notifications
You must be signed in to change notification settings - Fork 627
fix: remove errant Field.Field usage and useForm().useField()
#2149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
56c0c41
f0bc85d
16aab4d
b96cd7d
93f4ef0
064afe6
898223f
e421837
348ab8d
804bc53
a2b8078
2e14fe3
45474c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,6 @@ import type { | |
| FieldValidators, | ||
| FormAsyncValidateOrFn, | ||
| FormValidateOrFn, | ||
| Narrow, | ||
| } from '@tanstack/form-core' | ||
|
|
||
| import type { Accessor, JSX, JSXElement } from 'solid-js' | ||
|
|
@@ -51,94 +50,6 @@ interface SolidFieldApi< | |
| > | ||
| } | ||
|
|
||
| export type CreateField< | ||
| TParentData, | ||
| TFormOnMount extends undefined | FormValidateOrFn<TParentData>, | ||
| TFormOnChange extends undefined | FormValidateOrFn<TParentData>, | ||
| TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>, | ||
| TFormOnBlur extends undefined | FormValidateOrFn<TParentData>, | ||
| TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>, | ||
| TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>, | ||
| TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>, | ||
| TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>, | ||
| TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>, | ||
| TFormOnServer extends undefined | FormAsyncValidateOrFn<TParentData>, | ||
| TParentSubmitMeta, | ||
| > = < | ||
| TName extends DeepKeys<TParentData>, | ||
| TData extends DeepValue<TParentData, TName>, | ||
| TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData>, | ||
| TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData>, | ||
| TOnChangeAsync extends | ||
| | undefined | ||
| | FieldAsyncValidateOrFn<TParentData, TName, TData>, | ||
| TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData>, | ||
| TOnBlurAsync extends | ||
| | undefined | ||
| | FieldAsyncValidateOrFn<TParentData, TName, TData>, | ||
| TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData>, | ||
| TOnSubmitAsync extends | ||
| | undefined | ||
| | FieldAsyncValidateOrFn<TParentData, TName, TData>, | ||
| TOnDynamic extends undefined | FieldValidateOrFn<TParentData, TName, TData>, | ||
| TOnDynamicAsync extends | ||
| | undefined | ||
| | FieldAsyncValidateOrFn<TParentData, TName, TData>, | ||
| >( | ||
| opts: () => { name: Narrow<TName> } & CreateFieldOptionsBound< | ||
| TParentData, | ||
| TName, | ||
| TData, | ||
| TOnMount, | ||
| TOnChange, | ||
| TOnChangeAsync, | ||
| TOnBlur, | ||
| TOnBlurAsync, | ||
| TOnSubmit, | ||
| TOnSubmitAsync, | ||
| TOnDynamic, | ||
| TOnDynamicAsync | ||
| >, | ||
| ) => () => FieldApi< | ||
| TParentData, | ||
| TName, | ||
| TData, | ||
| TOnMount, | ||
| TOnChange, | ||
| TOnChangeAsync, | ||
| TOnBlur, | ||
| TOnBlurAsync, | ||
| TOnSubmit, | ||
| TOnSubmitAsync, | ||
| TOnDynamic, | ||
| TOnDynamicAsync, | ||
| TFormOnMount, | ||
| TFormOnChange, | ||
| TFormOnChangeAsync, | ||
| TFormOnBlur, | ||
| TFormOnBlurAsync, | ||
| TFormOnSubmit, | ||
| TFormOnSubmitAsync, | ||
| TFormOnDynamic, | ||
| TFormOnDynamicAsync, | ||
| TFormOnServer, | ||
| TParentSubmitMeta | ||
| > & | ||
| SolidFieldApi< | ||
| TParentData, | ||
| TFormOnMount, | ||
| TFormOnChange, | ||
| TFormOnChangeAsync, | ||
| TFormOnBlur, | ||
| TFormOnBlurAsync, | ||
| TFormOnSubmit, | ||
| TFormOnSubmitAsync, | ||
| TFormOnDynamic, | ||
| TFormOnDynamicAsync, | ||
| TFormOnServer, | ||
| TParentSubmitMeta | ||
| > | ||
|
|
||
| // ugly way to trick solid into triggering updates for changes on the fieldApi | ||
| function makeFieldReactive< | ||
| TParentData, | ||
|
|
@@ -326,23 +237,7 @@ export function createField< | |
|
|
||
| const api = new FieldApi(options) | ||
|
|
||
| const extendedApi: typeof api & | ||
| SolidFieldApi< | ||
| TParentData, | ||
| TFormOnMount, | ||
| TFormOnChange, | ||
| TFormOnChangeAsync, | ||
| TFormOnBlur, | ||
| TFormOnBlurAsync, | ||
| TFormOnSubmit, | ||
| TFormOnSubmitAsync, | ||
| TFormOnDynamic, | ||
| TFormOnDynamicAsync, | ||
| TFormOnServer, | ||
| TParentSubmitMeta | ||
| > = api as never | ||
|
|
||
| extendedApi.Field = Field as never | ||
| const extendedApi: typeof api = api as never | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify mismatch: runtime assignment removed, but type still includes SolidFieldApi in createField path.
rg -n -C3 "const extendedApi: typeof api = api as never|extendedApi\\.Field\\s*=|function makeFieldReactive|SolidFieldApi<" packages/solid-form/src/createField.tsxRepository: TanStack/form Length of output: 1119 🏁 Script executed: # First, let's see the full SolidFieldApi interface definition
sed -n '23,52p' packages/solid-form/src/createField.tsxRepository: TanStack/form Length of output: 1112 🏁 Script executed: # Now let's see the full context around line 240 and how extendedApi is used after
sed -n '235,280p' packages/solid-form/src/createField.tsxRepository: TanStack/form Length of output: 1033 🏁 Script executed: # Check if extendedApi.Field is assigned anywhere in the file
rg -n "extendedApi\.Field\s*=" packages/solid-form/src/createField.tsxRepository: TanStack/form Length of output: 39 🏁 Script executed: # Also check the return type and return statement of makeFieldReactive
sed -n '150,160p' packages/solid-form/src/createField.tsxRepository: TanStack/form Length of output: 258 🏁 Script executed: # Get the complete return statement starting from line 250+
sed -n '260,300p' packages/solid-form/src/createField.tsxRepository: TanStack/form Length of output: 1054 🏁 Script executed: # Check all uses of extendedApi in the file
rg -n "extendedApi" packages/solid-form/src/createField.tsxRepository: TanStack/form Length of output: 138 🏁 Script executed: # Also, let's see the makeFieldReactive function's return statement
sed -n '155,180p' packages/solid-form/src/createField.tsxRepository: TanStack/form Length of output: 774 🏁 Script executed: # Get the createField function signature with return type
sed -n '167,210p' packages/solid-form/src/createField.tsxRepository: TanStack/form Length of output: 1952 🏁 Script executed: # Get the return type annotation of createField
sed -n '207,225p' packages/solid-form/src/createField.tsxRepository: TanStack/form Length of output: 439 🏁 Script executed: # Get more of the function signature to find the return type
sed -n '220,240p' packages/solid-form/src/createField.tsxRepository: TanStack/form Length of output: 462 🏁 Script executed: # Search for the return type annotation more precisely
rg -n "^\) " packages/solid-form/src/createField.tsx | head -5Repository: TanStack/form Length of output: 73 🏁 Script executed: # Also check the full createField signature with better context
sed -n '174,236p' packages/solid-form/src/createField.tsx | grep -n "=>"Repository: TanStack/form Length of output: 94 🏁 Script executed: # Get a cleaner view of the full createField function signature
awk '/^export function createField</,/^\) \{/' packages/solid-form/src/createField.tsx | tail -30Repository: TanStack/form Length of output: 694 🏁 Script executed: # Check if Field property is ever added anywhere in the createField function
sed -n '238,290p' packages/solid-form/src/createField.tsxRepository: TanStack/form Length of output: 1183 Type contract advertises
The root cause is that Either add the Field property to 🤖 Prompt for AI Agents |
||
|
|
||
| let mounted = false | ||
| // Instantiates field meta and removes it when unrendered | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.