Skip to content

Fix false positive warning about broken component conditionals - #6631

Merged
sergei-maertens merged 2 commits into
mainfrom
issue/6621-false-positive-warning-form-designer
Sep 9, 2026
Merged

Fix false positive warning about broken component conditionals#6631
sergei-maertens merged 2 commits into
mainfrom
issue/6621-false-positive-warning-form-designer

Conversation

@sergei-maertens

Copy link
Copy Markdown
Member

Closes #6621

Changes

  • Added regression test in storybook
  • Fixed the flattenComponents to return properly namespaced keys for comparison

Checklist

Check off the items that are completed or not relevant.

  • Impact on features

    • Checked copying a form
    • Checked import/export of a form
    • Config checks in the configuration overview admin page
    • Checked new model fields are usable in the admin
    • Problem detection in the admin email digest is handled
  • Dockerfile/scripts

    • Updated the Dockerfile with the necessary scripts from the ./bin folder
  • Commit hygiene

    • Commit messages refer to the relevant Github issue
    • Commit messages explain the "why" of change, not the how
  • Documentation

    • Added documentation which describes the changes

…etection

Conditionals inside editgrids get namespaced with the parent editgrid
key, and when building a flattened map of all components, that
namespacing logic needs to be replicated to detect broken conditionals.

The builder iterComponents keeps track of this relation, so we can
opt-in to fully qualified keys.

This is not the default, because there are other call sites that rely
on the current behaviour where the direct key value (without namespace)
is being compared. One other call site checks this map for the unique
key generation, and that one *is* a candidate to opt-in to these
namespaced keys because editgrids do not technically require child
components to have unique keys (but we cannot currently do this yet as
our backend works under this assumption, and just opting it would not
enable this yet as the global namespace still creates unnecessary
restrictions...)
@github-actions github-actions Bot added the needs-backport Fix must be backported to stable release branch label Sep 8, 2026
carry[configuration.component.key] = configuration.component;
// You can either index by `key` or `dataPath`, where the latter is the fully qualified
// path with parent keys (for editgrids).
const flattenComponents = (components, indexBy = 'key') =>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really, really miss typescript for these kind of things 😭

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, thats the kind of stuff typescript can nicely gatekeep. Hopefully one day.. 🙏

@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.25%. Comparing base (0d0b4d1) to head (21f808c).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6631   +/-   ##
=======================================
  Coverage   97.25%   97.25%           
=======================================
  Files         859      859           
  Lines       33275    33275           
  Branches     2998     2998           
=======================================
  Hits        32363    32363           
  Misses        603      603           
  Partials      309      309           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sergei-maertens
sergei-maertens merged commit b2b243c into main Sep 9, 2026
31 checks passed
@sergei-maertens
sergei-maertens deleted the issue/6621-false-positive-warning-form-designer branch September 9, 2026 12:18
sergei-maertens added a commit that referenced this pull request Sep 9, 2026
…etection

Conditionals inside editgrids get namespaced with the parent editgrid
key, and when building a flattened map of all components, that
namespacing logic needs to be replicated to detect broken conditionals.

The builder iterComponents keeps track of this relation, so we can
opt-in to fully qualified keys.

This is not the default, because there are other call sites that rely
on the current behaviour where the direct key value (without namespace)
is being compared. One other call site checks this map for the unique
key generation, and that one *is* a candidate to opt-in to these
namespaced keys because editgrids do not technically require child
components to have unique keys (but we cannot currently do this yet as
our backend works under this assumption, and just opting it would not
enable this yet as the global namespace still creates unnecessary
restrictions...)

(cherry picked from commit ca603a1)
(cherry picked from commit 21f808c)

Backport-of: #6631
@sergei-maertens

Copy link
Copy Markdown
Member Author

Backports:

Older versions aren't affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-backport Fix must be backported to stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The form designer incorrectly shows warnings about broken component references

2 participants