Malarg commented on code in PR #24338:
URL: https://github.com/apache/beam/pull/24338#discussion_r1033120054
##########
playground/frontend/lib/modules/editor/components/share_dropdown/share_tabs/snippet_save_and_share_tabs.dart:
##########
@@ -16,32 +16,59 @@
* limitations under the License.
*/
+import 'dart:async';
+
import 'package:flutter/material.dart';
import
'package:playground/modules/editor/components/share_dropdown/share_tabs/example_share_tabs.dart';
import 'package:playground_components/playground_components.dart';
-class SnippetSaveAndShareTabs extends StatelessWidget {
+class SnippetSaveAndShareTabs extends StatefulWidget {
+ final VoidCallback onError;
final PlaygroundController playgroundController;
final TabController tabController;
const SnippetSaveAndShareTabs({
super.key,
+ required this.onError,
required this.playgroundController,
required this.tabController,
});
+ @override
+ State<SnippetSaveAndShareTabs> createState() =>
_SnippetSaveAndShareTabsState();
+}
+
+class _SnippetSaveAndShareTabsState extends State<SnippetSaveAndShareTabs> {
+ Future<String>? _future;
+
+ @override
+ void initState() {
+ super.initState();
+ unawaited(_initSaving());
+ }
+
+ Future<void> _initSaving() async {
+ try {
+ _future = widget.playgroundController.saveSnippet();
+ await _future;
+ } on Exception catch (ex) {
+ PlaygroundComponents.toastNotifier.addException(ex);
+ widget.onError();
Review Comment:
I think that that display exceedingly clear exception message is essential
part of user experience. So if every separate place requires unique message -
it should be done. Through on practice I think that most of messages may be
equal, but in this case is not
--
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]