altinn-studio
altinn-studio copied to clipboard
Fix expression crash when linked ID doesn't exist anymore
Description
Updated how subexpressions handle deleted linked IDs using existing validation logic. Expanded isComponentValueValid to also verify if the selected ID exists in the available options.
Now, when enabling edit mode, instead of making Studio crash due to a selected value that no longer exists in the Combobox options, an error message appears below the Combobox and the invalid selection is automatically cleared.
Additionally, applied red styling to the subexpression border when not in edit mode to visually alert users to any issues with the subexpression.
Before:
https://github.com/Altinn/altinn-studio/assets/74791975/0abab700-7332-4fa8-b6f4-b00a6ef918f7
After:
https://github.com/Altinn/altinn-studio/assets/74791975/3b3b6eb4-06b0-4230-b3fc-048a6521c3ed
Related Issue(s)
- #12564
Verification
- [x] Your code builds clean without any errors or warnings
- [x] Manual testing done (required)
- [x] Relevant automated test added (if you find this hard, leave it and we'll help out)
Documentation
- [ ] User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 90.36%. Comparing base (
b26b300
) to head (91f1b25
).
Additional details and impacted files
@@ Coverage Diff @@
## main #12746 +/- ##
=======================================
Coverage 90.36% 90.36%
=======================================
Files 1320 1320
Lines 18933 18936 +3
Branches 2306 2309 +3
=======================================
+ Hits 17108 17111 +3
Misses 1563 1563
Partials 262 262
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.