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

Cyclic dependency error when using concat #1969

Closed
aaronabf opened this issue Apr 3, 2023 · 0 comments
Closed

Cyclic dependency error when using concat #1969

aaronabf opened this issue Apr 3, 2023 · 0 comments

Comments

@aaronabf
Copy link

aaronabf commented Apr 3, 2023

There is a regression of #1423 when Yup was upgraded from 0.32.11 to 1.0.0 in which when using concat on an object schema with a dependency list it seems to be ignored.

To reproduce, simply go to the Code Sandbox link provided in the referenced issue and update the Yup version:

  1. Visit https://codesandbox.io/s/yup-concat-order-pemfy?file=/src/index.js
  2. Update yup to 0.32.11 and observe there is no issue
  3. Update yup to 1.0.2 and observe the original issue surfaces: "Cyclic dependency"

You can also observe the issue when using a more minimal example than the Code Sandbox example:

import * as Yup from "yup";

const a = Yup.object().shape(
  {
    a1: Yup.string().when("a2", {
      is: undefined,
      then: Yup.string().required()
    }),
    a2: Yup.string().when("a1", {
      is: undefined,
      then: Yup.string().required()
    })
  },
  [["a1", "a2"]]
);

// works
const b = Yup.object().shape({
  b1: Yup.string().required(),
});

// doesn't work
const c = b
  .concat(a);
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

1 participant