Skip to content
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

fix(lit-form): initialize api before adding controller #1254

Merged
merged 3 commits into from
Mar 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ Defined in: [tanstack-form-controller.ts:206](https://github.com/TanStack/form/b
field<TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync>(fieldConfig, render): object
```

Defined in: [tanstack-form-controller.ts:260](https://github.com/TanStack/form/blob/main/packages/lit-form/src/tanstack-form-controller.ts#L260)
Defined in: [tanstack-form-controller.ts:259](https://github.com/TanStack/form/blob/main/packages/lit-form/src/tanstack-form-controller.ts#L259)

#### Type Parameters

@@ -145,7 +145,7 @@ render: renderCallback<TParentData, TName, TData, TOnMount, TOnChange, TOnChange
hostConnected(): void
```

Defined in: [tanstack-form-controller.ts:250](https://github.com/TanStack/form/blob/main/packages/lit-form/src/tanstack-form-controller.ts#L250)
Defined in: [tanstack-form-controller.ts:249](https://github.com/TanStack/form/blob/main/packages/lit-form/src/tanstack-form-controller.ts#L249)

Called when the host is connected to the component tree. For custom
element hosts, this corresponds to the `connectedCallback()` lifecycle,
@@ -169,7 +169,7 @@ ReactiveController.hostConnected
hostDisconnected(): void
```

Defined in: [tanstack-form-controller.ts:256](https://github.com/TanStack/form/blob/main/packages/lit-form/src/tanstack-form-controller.ts#L256)
Defined in: [tanstack-form-controller.ts:255](https://github.com/TanStack/form/blob/main/packages/lit-form/src/tanstack-form-controller.ts#L255)

Called when the host is disconnected from the component tree. For custom
element hosts, this corresponds to the `disconnectedCallback()` lifecycle,
3 changes: 1 addition & 2 deletions packages/lit-form/src/tanstack-form-controller.ts
Original file line number Diff line number Diff line change
@@ -231,8 +231,6 @@ export class TanStackFormController<
TSubmitMeta
>,
) {
;(this.#host = host).addController(this)

this.api = new FormApi<
TParentData,
TFormOnMount,
@@ -245,6 +243,7 @@ export class TanStackFormController<
TFormOnServer,
TSubmitMeta
>(config)
;(this.#host = host).addController(this)
}

hostConnected() {