Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/BEAM-13531' into beta-version
Browse files Browse the repository at this point in the history
# Conflicts:
#	playground/frontend/lib/modules/examples/models/example_model.dart
#	playground/frontend/lib/pages/playground/states/examples_state.dart
  • Loading branch information
daria-malkova committed Dec 23, 2021
2 parents 4743f51 + 5e56b17 commit 0bd6283
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ class ExampleModel with Comparable<ExampleModel> {
@override
int get hashCode => path.hashCode;

bool isInfoFetched() {
// checking only source, because outputs/logs can be empty
return source?.isNotEmpty ?? false;
}

@override
int compareTo(ExampleModel other) {
return name.toLowerCase().compareTo(other.name.toLowerCase());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,13 @@ class ExampleState with ChangeNotifier {
}

Future<ExampleModel> loadExampleInfo(ExampleModel example, SDK sdk) async {
final exampleData = await Future.wait([
getExampleSource(example.path, sdk),
getExampleOutput(example.path, sdk),
getExampleLogs(example.path, sdk)
]);
example.setSource(exampleData[0]);
example.setOutputs(exampleData[1]);
example.setLogs(exampleData[2]);
if (example.isInfoFetched()) {
return example;
}
String source = await getExampleSource(example.path, sdk);
example.setSource(source);
final outputs = await getExampleOutput(example.path, sdk);
example.setOutputs(outputs);
return example;
}

Expand Down

0 comments on commit 0bd6283

Please sign in to comment.