specklesystems / speckle-sharp

.NET SDK, Schema and Connectors: Revit, Rhino, Grasshopper, Dynamo, ETABS, AutoCAD, Civil3D & more.
https://speckle.systems
Apache License 2.0
379 stars 173 forks source link

fix(navis): Fixes missing element properties on coalesce from First Selected object. #3651

Closed jsdbroughton closed 2 weeks ago

jsdbroughton commented 2 weeks ago

Property Grouping Logic Change

What Changed

Modified the LINQ query for property grouping to retain all groups regardless of value uniqueness, rather than filtering out groups with different values. Now takes the first value encountered for each key instead of requiring all values to be identical.

Before

.Where(
    group => group.Select(
        item => item.Value
    ).Distinct().Count() == 1
)

Previously filtered out any groups where values differed, only keeping groups with identical values.

After

// Simplified to just take first value for each key
.ToDictionary(
    group => group.Key,
    group => group.Select(item => item.Value).First()
)

Why

The previous logic was too restrictive, discarding valid property groups just because they had different values. The new approach preserves all property groups while maintaining deterministic value selection.