Skip to content

Commit

Permalink
Sort CustomScalarImports
Browse files Browse the repository at this point in the history
Summary:
* `meerkat` was emitting a custom scalar import out of order. This will hopefully fix it!

* We've seen instances of `CustomScalarImport`'s being emitted in different orders, though using the same source file. Sorting the `CustomScalarImport` before printing it might remove this inconsistent behavior.
* In particular, there is an instance of a custom scalar that is currently in reverse-alphabetical order in the checked-in generated artifact; this artifact is the one gets generated inconsistently. This diff changes that generated artifact, increasing my confidence that this will help.

Reviewed By: kassens

Differential Revision: D43368527

fbshipit-source-id: 500715406a141363f1c9a7b4243605fbe239ebb2
  • Loading branch information
Robert Balicki authored and facebook-github-bot committed Feb 16, 2023
1 parent 7ee915d commit 2e449af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/crates/relay-typegen/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ fn write_custom_scalar_imports(
custom_scalars: CustomScalarsImports,
writer: &mut Box<dyn Writer>,
) -> FmtResult {
for (name, path) in custom_scalars.iter() {
for (name, path) in custom_scalars.iter().sorted_by_key(|(key, _)| *key) {
writer.write_import_type(&[name.lookup()], path.to_str().unwrap())?
}

Expand Down

0 comments on commit 2e449af

Please sign in to comment.