Error on recursive schema: Maximum recursive updates exceeded in component <OneOfRenderer>

Hi everyone!
I’m working on a recursive schema that could have a leaf or a branch that could recursively have leaf/branch.
When I try to add a children I got a lot of logs from the AJV validator:

Combinator subschema is not self contained, can't hand it over to AJV

and after a while, it ends up throwing a max recursive error:

Uncaught (in promise) Maximum recursive updates exceeded in component . This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.

This is the JSON schema I’m using:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Configuration",
  "type": "object",
  "definitions": {
    "tree_leaf": {
      "type": "object",
      "properties": {
        "value": {
          "type": "string"
        },
        "label": {
          "description": "A human readable name (if left out the value will be title cased)",
          "type": "string"
        }
      },
      "required": ["value"],
      "additionalProperties": false
    },
    "tree_branch": {
      "type": "object",
      "properties": {
        "children": {
          "description": "Array of children. Either children or value needs to be provided",
          "$ref": "#/definitions/tree_options"
        },
        "label": {
          "description": "A human readable name (if left out the value will be title cased)",
          "type": "string"
        }
      },
      "required": ["children", "label"],
      "additionalProperties": false
    },
    "tree_options": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "oneOf": [
          {
            "title": "Leaf",
            "$ref": "#/definitions/tree_leaf"
          },
          {
            "title": "Branch",
            "$ref": "#/definitions/tree_branch"
          }
        ]
      }
    },
    "tree_picker": {
      "properties": {
        "values": {
          "$ref": "#/definitions/tree_options"
        }
      },
      "additionalProperties": false
    }
  },
  "properties": {
    "tree_picker": {
      "description": "Tree picker widget",
      "$ref": "#/definitions/tree_picker"
    }
  },
  "additionalProperties": false
}

Any help will be more than welcome! Thanks! :slight_smile:

Hi @fernandojsg,

We currently use AJV to determine the best element to show when we encounter a oneOf, however that only works if the oneOf is self-contained. If it isn’t the warning is shown and we just show the first one.

The max recursive error seems to indicate that we try to render an endlessly deep UI, which I would not have expected as the first element of the oneOf is actually the LEAF and even if we go down the branches, the rendering should stop at an empty array.

We need to check in more detail what is going wrong. Until then, feel free to debug why it tries to render endlessly deep. I would imagine something in the oneOf handling to go wrong.