Skip to content

Fix crash in logic rule when it contains a property action that refers to a non-existing component#6267

Merged
viktorvanwijk merged 2 commits into
mainfrom
bug/fix-crash-in-logic-rules
May 8, 2026
Merged

Fix crash in logic rule when it contains a property action that refers to a non-existing component#6267
viktorvanwijk merged 2 commits into
mainfrom
bug/fix-crash-in-logic-rules

Conversation

@viktorvanwijk
Copy link
Copy Markdown
Contributor

@viktorvanwijk viktorvanwijk commented May 8, 2026

Discovered while working on #6261

[skip: e2e]

Changes

Added a question mark

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

…ers to a non-existing component

When a rule contains a component that doesn't exist - this is still possible unfortunately because no validation is performed - the rule crashes in the admin.

By adding a ? we can avoid a crash
@viktorvanwijk viktorvanwijk added the needs-backport Fix must be backported to stable release branch label May 8, 2026
@viktorvanwijk viktorvanwijk requested a review from annashamray May 8, 2026 09:51
@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.08%. Comparing base (bfc90ed) to head (b15710f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6267   +/-   ##
=======================================
  Coverage   97.08%   97.08%           
=======================================
  Files         872      872           
  Lines       33122    33122           
  Branches     2990     2990           
=======================================
  Hits        32155    32155           
  Misses        652      652           
  Partials      315      315           

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Copy Markdown
Contributor

@annashamray annashamray left a comment

Choose a reason for hiding this comment

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

👍

const intl = useIntl();
const isLayout = action.component
? holdsSubmissionDataTypes.includes(components[action.component].type)
? holdsSubmissionDataTypes.includes(components[action.component]?.type)
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.

Oh! I didn't think of this possibility when added this line

@viktorvanwijk viktorvanwijk merged commit 9bed726 into main May 8, 2026
57 of 58 checks passed
@viktorvanwijk viktorvanwijk deleted the bug/fix-crash-in-logic-rules branch May 8, 2026 15:04
viktorvanwijk added a commit that referenced this pull request May 8, 2026
…ers to a non-existing component

When a rule contains a component that doesn't exist - this is still possible unfortunately because no validation is performed - the rule crashes in the admin.

By adding a ? we can avoid a crash

Backport of: #6267
@viktorvanwijk
Copy link
Copy Markdown
Contributor Author

Backport 3.5.x: 0abbb97

I see that the original bug (#5977) was not backported to 3.4.x. Was this intentional?

@annashamray
Copy link
Copy Markdown
Contributor

@viktorvanwijk No one asked for it and there was no "backport" label so...

@viktorvanwijk
Copy link
Copy Markdown
Contributor Author

Yeah I see, just wondering if there should have been one 😅 Usually bugs get backported

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.

2 participants