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

Is it possible to create a form with recursive field? #251

Open
mattp0123 opened this issue Sep 20, 2024 · 3 comments
Open

Is it possible to create a form with recursive field? #251

mattp0123 opened this issue Sep 20, 2024 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@mattp0123
Copy link

mattp0123 commented Sep 20, 2024

i have a form like this:

type Condition =
  | {
      type: 'composite'
      operator: 'and' | 'or'
      conditions: Condition[]
    }
  | OtherCondition

type Form = {
  condition: Condition
}

seems a bit like nested & array field approach. could have dynamic field path like:

<Field name={`condition.conditions.${index}.type`} />

but i got this error when i trying to create the form:

image

@fabian-hiller
Copy link
Owner

Hmm... the recursive type probably breaks the types of the library. 😐

@mattp0123
Copy link
Author

@fabian-hiller
Copy link
Owner

Yes, this might work, but it limits the depth. You can do this yourself by explicitly specifying a depth of only 10 instead of infinity in your schema.

@fabian-hiller fabian-hiller self-assigned this Sep 20, 2024
@fabian-hiller fabian-hiller added the question Further information is requested label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants