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

Typescript : initialValues should have RESET allowed #8

Open
pgangwani opened this issue May 13, 2024 · 2 comments · May be fixed by #9
Open

Typescript : initialValues should have RESET allowed #8

pgangwani opened this issue May 13, 2024 · 2 comments · May be fixed by #9

Comments

@pgangwani
Copy link

Describe the bug
I noticed that List component has missing type to accept RESET symbol.

To Reproduce
Steps to reproduce the behavior:

  1. Create <List ..>
  2. Add prop initialValue={RESET} in case of
  3. See the ts error

Expected behavior
Like initialValue in useList(,{initialValue}), it should accept RESET symbol.

Screenshots
If applicable, add screenshots to help explain your problem.

Screenshot 2024-05-13 at 11 05 27 PM
Screenshot 2024-05-13 at 11 02 09 PM

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

pgangwani pushed a commit to pgangwani/list-atom that referenced this issue May 13, 2024
@pgangwani pgangwani linked a pull request May 13, 2024 that will close this issue
@pgangwani
Copy link
Author

@MiroslavPetrik : Please review this issue and PR . Let me know if any question.

@MiroslavPetrik
Copy link
Member

The useFieldInitialValue hook indeed accepts the RESET symbol, so the request seems valid.
But looking at it practically, I would advise not to use it in such a way.
The purpose of the initialValue prop is to set the hydrated data, e.g. when you fetch that from the server.
The RESET symbol value, is to clear any changes back to the first hydrated value, which best is done via the reset action.

Do you really need it?

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

Successfully merging a pull request may close this issue.

2 participants