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

TanStack/Angular - Error when resetting the form #671

Closed
luishcastroc opened this issue Apr 12, 2024 · 1 comment
Closed

TanStack/Angular - Error when resetting the form #671

luishcastroc opened this issue Apr 12, 2024 · 1 comment

Comments

@luishcastroc
Copy link
Contributor

Describe the bug

When i add the functionality to "reset" the form it will break the implementation.

Your minimal, reproducible example

https://stackblitz.com/github/tanstack/form/tree/main/examples/angular/simple?embed=1&theme=light&preset=node

Steps to reproduce

  1. Open the Stackblitz
  2. add a button for clear using this code:
<button type="reset" (click)="form.reset()">
        Clear
      </button>
  1. click on any input and get out to get the validation error.
  2. click the clear button, validation should be gone
  3. click on any input and get out of it
  4. you should see an error.
chunk-3AFBTSQG.js?v=a3ca62aa:6796 ERROR TypeError: Cannot convert undefined or null to object
    at Function.values (<anonymous>)
    at Object.onUpdate (@tanstack_angular-form.js?v=7c012f42:961:38)
    at Store.setState (@tanstack_angular-form.js?v=7c012f42:43:87)
    at @tanstack_angular-form.js?v=7c012f42:681:24
    at Store.batch (@tanstack_angular-form.js?v=7c012f42:60:7)
    at @tanstack_angular-form.js?v=7c012f42:674:20
    at @tanstack_angular-form.js?v=7c012f42:53:9
    at Set.forEach (<anonymous>)
    at Store._flush (@tanstack_angular-form.js?v=7c012f42:50:22)
    at Store.setState (@tanstack_angular-form.js?v=7c012f42:44:12)
    ```

### Expected behavior

The form should be cleared and validators should reset with no errors.

### How often does this bug happen?

Every time

### Screenshots or Videos

_No response_

### Platform

- OS: Mac OS
- Browser: Chrome Version 123.0.6312.107 (Official Build) (arm64)

### TanStack Form adapter

None

### TanStack Form version

@tanstack/angular-form": "^0.19.0"

### TypeScript version

5.4.2

### Additional context

There's no option to add the proper platform to the issue but the platform is **Angular**
@crutchcorn
Copy link
Member

This should be fixed in the latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants