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

issue: Unregister useFieldArray not working when value is empty array #10129

Closed
1 task done
hendra-foo opened this issue Mar 17, 2023 · 0 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@hendra-foo
Copy link

Version Number

7.43.6

Codesandbox/Expo snack

https://codesandbox.io/s/unregister-array-field-not-working-kemxln?file=/src/App.tsx

Steps to reproduce

  1. Go to Provided Code Sandbox Link
  2. Click on 'With Cart' input radio, console is logging {type: "WITH_CART", cart: Array(0)}
  3. Click on 'No Cart' input radio, console will still logging {type: "WITH_CART", cart: Array(0)}
  4. Click on 'With Cart' input radio again, and click 'APPEND' button once, console now logging {type: "WITH_CART", cart: Array(1)}
  5. Click on 'No Cart' input radio again, console will log {type: "NO_CART"}

Expected behaviour

The cart should be unregistered when on step 3

What browsers are you seeing the problem on?

Chrome

Relevant log output

{type: "NO_CART"}
{type: "WITH_CART"}
{type: "WITH_CART", cart: Array(0)}
{type: "NO_CART", cart: Array(0)}
{type: "NO_CART", cart: Array(0)}
{type: "WITH_CART", cart: Array(0)}
{type: "WITH_CART", cart: Array(0)}
{type: "WITH_CART", cart: Array(1)}
{type: "NO_CART", cart: Array(1)}
{type: "NO_CART"}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@bluebill1049 bluebill1049 added status: under investigation aware of this issue and pending for investigation bug Something isn't working and removed status: under investigation aware of this issue and pending for investigation labels Mar 17, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants