Skip to content

Validation.js raises "Cannot read properties of undefined" error #1299

@boris-burgos

Description

@boris-burgos

Description

When a <Query> component's fields are updated while a condition still references a removed field, an "Uncaught TypeError: Cannot read properties of undefined" is thrown, causing the component to crash.

Reproduction

Live example: Netlify demo
Source code: GitHub

Steps:

  1. Click "Add group".
  2. Select "Test group" in the group selector.
  3. Select "Number field" in the field selector.
  4. Click "Clear" near the top-left selector to remove the group's fields.
  5. Component crashes.

Expected behavior

The component should not crash. Removed fields should be handled gracefully, keeping the component functional.

Example of correct behavior: Netlify demo

Additional context

The issue originates in validation.js where item becomes undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions