Fix sample-type visibility and AST commit crash (#14018, #14156, #14124)#14166
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughUpdates SampleMaterial visibility metadata for two specimen types, adjusts one inline specimen comment, adds a null guard to ChangesSample Material Visibility
UI Form Fixes
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
sormas-ui/src/main/java/de/symeda/sormas/ui/therapy/DrugSusceptibilityForm.java (1)
351-358: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueNull guard looks correct given existing clear-on-hide behavior.
Skipping
super.commit()whengetValue()is null avoids the crash while the form is unbound/inapplicable. SinceupdateFieldsVisibility()already clears field values whenever the disease/test-type combination doesn't apply or the DTO is null before this state, no user-entered data should be silently dropped by this guard.One nit: a short comment on why the null check is needed (e.g., referencing the crash it prevents) would help future maintainers avoid removing it by mistake.
📝 Optional: document rationale
`@Override` public void commit() { + // Guard against committing when no DrugSusceptibilityDto is bound (e.g. form hidden/inapplicable); + // calling super.commit() in that state previously caused a crash. if (getValue() == null) { return; } super.commit(); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sormas-ui/src/main/java/de/symeda/sormas/ui/therapy/DrugSusceptibilityForm.java` around lines 351 - 358, Add a brief inline comment in DrugSusceptibilityForm.commit() next to the getValue() null guard explaining that super.commit() is skipped because the form can be unbound/inapplicable and this prevents the crash; keep the existing null check and reference the clear-on-hide behavior/updateFieldsVisibility logic so the intent is obvious to future maintainers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@sormas-ui/src/main/java/de/symeda/sormas/ui/therapy/DrugSusceptibilityForm.java`:
- Around line 351-358: Add a brief inline comment in
DrugSusceptibilityForm.commit() next to the getValue() null guard explaining
that super.commit() is skipped because the form can be unbound/inapplicable and
this prevents the crash; keep the existing null check and reference the
clear-on-hide behavior/updateFieldsVisibility logic so the intent is obvious to
future maintainers.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1d030d1a-823b-464f-85c7-9a13349828d6
📒 Files selected for processing (3)
sormas-api/src/main/java/de/symeda/sormas/api/sample/SampleMaterial.javasormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/ImiSectionComponent.javasormas-ui/src/main/java/de/symeda/sormas/ui/therapy/DrugSusceptibilityForm.java
💤 Files with no reviewable changes (1)
- sormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/ImiSectionComponent.java
Fixes #14018 #14156 #14124
Summary by CodeRabbit