Skip to content

Commit c1e009f

Browse files
Sort nodes alphabetically when generating selection expressions (#8551)
Co-authored-by: Michael Staib <[email protected]>
1 parent 35bcd91 commit c1e009f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/HotChocolate/Core/src/Execution.Projections/SelectionExpressionBuilder.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ private void CollectTypes(Context context, ISelection selection, TypeContainer p
170170
{
171171
var assignments = ImmutableArray.CreateBuilder<MemberAssignment>();
172172

173-
foreach (var property in parent.Nodes)
173+
// order by property name so expressions evalutate to the same hash regardless of selection order
174+
foreach (var property in parent.Nodes.OrderBy(node => node.Property.Name))
174175
{
175176
var assignment = BuildAssignmentExpression(property, context);
176177
if (assignment is not null)

0 commit comments

Comments
 (0)