Skip to content

Commit

Permalink
Only sorting variables on fetch to avoid sort during configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McMahan committed Jun 28, 2024
1 parent 21dbb6e commit 0019dd9
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,9 @@ export class MlModelFormComponent implements OnInit {
const ts = this.value('timespans');
variables = await this.mlModelsService.getVariables(input, dataset, ts);
variables.sort((a: Variable, b: Variable) => {
return a.source.localeCompare(b.source);
const aCompare = `${a.role + a.source + a.name}`;
const bCompare = `${b.role + b.source + a.name}`;
return aCompare.localeCompare(bCompare);
});
this.cachedVariables = variables;
this.errorMessage = '';
Expand Down Expand Up @@ -463,12 +465,6 @@ export class MlModelFormComponent implements OnInit {
return;
}

existingVariables.sort((a: Variable, b: Variable) => {
const aCompare = `${a.source + a.role}`;
const bCompare = `${b.source + b.role}`;
return aCompare.localeCompare(bCompare);
});

let controls = [];

for (let existingVariable of existingVariables) {
Expand Down

0 comments on commit 0019dd9

Please sign in to comment.