alexeyinkin commented on code in PR #24338:
URL: https://github.com/apache/beam/pull/24338#discussion_r1031605265
##########
playground/frontend/playground_components/lib/src/controllers/example_loaders/examples_loader.dart:
##########
@@ -48,58 +50,98 @@ class ExamplesLoader {
_playgroundController = value;
}
+ /// Loads examples from [descriptor]'s immediate list.
+ ///
+ /// Sets empty editor for SDKs of failed examples.
Future<void> load(ExamplesLoadingDescriptor descriptor) async {
if (_descriptor == descriptor) {
return;
}
_descriptor = descriptor;
- await Future.wait(
- descriptor.descriptors.map(
- (one) => loadOne(group: descriptor, one: one),
- ),
- );
+ final loaders = descriptor.descriptors.map(_createLoader).whereNotNull();
+
+ try {
+ final loadFutures = loaders.map(_loadOne);
+ await Future.wait(loadFutures);
+ } on Exception catch (ex) {
+ _emptyMissing(loaders);
+ throw ExampleLoadingException(ex);
+ }
final sdk = descriptor.initialSdk;
if (sdk != null) {
_playgroundController!.setSdk(sdk);
}
}
- Future<void> loadDefaultIfAny(Sdk sdk) async {
- final group = _descriptor;
- final one = group?.lazyLoadDescriptors[sdk]?.firstOrNull;
+ ExampleLoader? _createLoader(ExampleLoadingDescriptor descriptor) {
+ final loader = defaultFactory.create(
+ descriptor: descriptor,
+ exampleCache: _playgroundController!.exampleCache,
+ );
- if (group == null || one == null) {
+ if (loader == null) {
+ // TODO: Log.
Review Comment:
`+`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]