alexeyinkin commented on code in PR #21926:
URL: https://github.com/apache/beam/pull/21926#discussion_r900370313


##########
playground/frontend/lib/modules/examples/components/example_list/expansion_panel_item.dart:
##########
@@ -48,12 +48,12 @@ class ExpansionPanelItem extends StatelessWidget {
           onTap: () async {
             if (playgroundState.selectedExample != example) {
               closeDropdown(exampleState);
+              AnalyticsService.get(context).trackSelectExample(example);
               final exampleWithInfo = await exampleState.loadExampleInfo(
                 example,
                 playgroundState.sdk,
               );
               playgroundState.setExample(exampleWithInfo);
-              
AnalyticsService.get(context).trackSelectExample(exampleWithInfo);

Review Comment:
   This bug had been preventing the tracking. By the time the `await` above 
would have completed, the widget is rebuilt and `context` is no longer usable, 
so an exception here had been preventing the tracking.
   
   This can be safely moved before the asynchronous gap because for tracking we 
only need the example path that is already there.
   
   Still in future we better have two separate classes for incomplete and fully 
loaded examples, so method signatures would indicate where an incomplete 
example will do.



-- 
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]

Reply via email to