Fixes #2891 Axis Settings shows an empty Dimension for merged dimensions#2892
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesMerged Dimension Reference Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Problem
In the single-axis Axis Settings dialog, the Dimension field rendered blank for an axis whose dimension is a merged dimension (e.g. a Concentration axis with unit
µmol/l), even though the Unit was populated and the axis-options grid showed the dimension correctly.Root cause
getMergedDimensionsinserted the axis's own dimension instance first (keyed byDisplayName), then the loop overwrote that same key with a freshly-minted merged-dimension instance (IDimensionFactory.MergedDimensionForis not cached — it returns a new object on every call). SinceDimension/MergedDimensionForcompare by reference, the combo binder could no longer match the axis's instance to any list item, so it rendered blank. Only mergeable dimensions (e.g. molar↔mass Concentration) hit this; non-mergeable dimensions return the same factory-owned instance each call and were unaffected.Fix
Move the
defaultDimensioninsertion to after the loop ingetMergedDimensions, so the axis's actual instance wins theDisplayNamekey and reference-matches in the editor. No behavior change for non-mergeable dimensions.Test
Added a regression spec that builds a dimension factory with merging information and asserts the editor list contains the exact merged-dimension instance held by the axis (fails without the fix, passes with it).
Verified manually in PK-Sim: opening Axis Settings on a concentration axis of a time profile now shows the populated Dimension combo.
Fixes #2891
Summary by CodeRabbit