diff --git a/compiler/crates/relay-codegen/src/build_ast.rs b/compiler/crates/relay-codegen/src/build_ast.rs index bb1832ed005e1..4c748af939112 100644 --- a/compiler/crates/relay-codegen/src/build_ast.rs +++ b/compiler/crates/relay-codegen/src/build_ast.rs @@ -264,12 +264,14 @@ pub fn build_resolvers_schema( } } if !fields.is_empty() { + fields.sort_by_key(|field| field.key); map.push(ObjectEntry { key: object.name.item.0, value: Primitive::Key(ast_builder.intern(Ast::Object(fields))), }) } } + map.sort_by_key(|field| field.key); ast_builder.intern(Ast::Object(map)) } diff --git a/compiler/crates/relay-compiler/tests/relay_compiler_integration/fixtures/resolver_semantic_non_null_custom_scalar.expected b/compiler/crates/relay-compiler/tests/relay_compiler_integration/fixtures/resolver_semantic_non_null_custom_scalar.expected index 20c294eca5e8a..53f0d7cb22409 100644 --- a/compiler/crates/relay-compiler/tests/relay_compiler_integration/fixtures/resolver_semantic_non_null_custom_scalar.expected +++ b/compiler/crates/relay-compiler/tests/relay_compiler_integration/fixtures/resolver_semantic_non_null_custom_scalar.expected @@ -65,7 +65,7 @@ type User { name: String } ==================================== OUTPUT =================================== //- __generated__/ResolversSchemaModule.js /** - * SignedSource<<8da0a1dd4b3c3a10115920f878c9f044>> + * SignedSource<<983b85d6af01334176c1f903eecd63de>> * @flow * @lightSyntaxTransform * @nogrep @@ -91,14 +91,14 @@ var schema_resolvers/*: SchemaResolvers*/ = { "resolverFunction": require('User_bar').bar_live, "rootFragment": null }, - "bar_plural": { - "resolverFunction": require('User_bar').bar_plural, - "rootFragment": null - }, "bar_live_plural": { "resolverFunction": require('User_bar').bar_live_plural, "rootFragment": null }, + "bar_plural": { + "resolverFunction": require('User_bar').bar_plural, + "rootFragment": null + }, "foo": { "resolverFunction": require('User_foo').foo, "rootFragment": require('UserFooFragment$normalization.graphql') diff --git a/compiler/crates/relay-compiler/tests/relay_compiler_integration/fixtures/resolver_semantic_non_null_relayresolvervalue.expected b/compiler/crates/relay-compiler/tests/relay_compiler_integration/fixtures/resolver_semantic_non_null_relayresolvervalue.expected index e9384f480a22c..db0f256a9a7cd 100644 --- a/compiler/crates/relay-compiler/tests/relay_compiler_integration/fixtures/resolver_semantic_non_null_relayresolvervalue.expected +++ b/compiler/crates/relay-compiler/tests/relay_compiler_integration/fixtures/resolver_semantic_non_null_relayresolvervalue.expected @@ -52,7 +52,7 @@ type User { name: String } ==================================== OUTPUT =================================== //- __generated__/ResolversSchemaModule.js /** - * SignedSource<<8da0a1dd4b3c3a10115920f878c9f044>> + * SignedSource<<983b85d6af01334176c1f903eecd63de>> * @flow * @lightSyntaxTransform * @nogrep @@ -78,14 +78,14 @@ var schema_resolvers/*: SchemaResolvers*/ = { "resolverFunction": require('User_bar').bar_live, "rootFragment": null }, - "bar_plural": { - "resolverFunction": require('User_bar').bar_plural, - "rootFragment": null - }, "bar_live_plural": { "resolverFunction": require('User_bar').bar_live_plural, "rootFragment": null }, + "bar_plural": { + "resolverFunction": require('User_bar').bar_plural, + "rootFragment": null + }, "foo": { "resolverFunction": require('User_foo').foo, "rootFragment": require('UserFooFragment$normalization.graphql')