What's the best way to handle an await when the form has been destroyed?

I have a dashboard form that is created when the user logs in, but if they click on another menu item before it finishes loading (the dashboard form is destroyed) I get an exception raised as it attempts to update controls that no longer exist.

Before I start creating my own solution I just wondered if anyone else has solved this already.

Example code

procedure TDashboard.LoadThingsToDo;
var
  lRetval: TXDataClientResponse;
  lResult: JS.TJSObject;
  lToDoList: JS.TJSArray;
begin
  ThingsToDo.BeginUpdate; //ThingsToDo is a TWebResponsiveGrid
  try
    ThingsToDo.Items.Clear;
    lRetval := await(TXDataClientResponse, MainData.WebClient.RawInvokeAsync(ITUTILSSVC_GET_THINGS_TODO, []));
    lResult := TJSObject(lRetval.Result);
    lToDoList := JS.toArray(lResult['value']);
    if (lToDoList <> nil) and (lToDoList.Length > 0) then
    begin
      ThingsToDo.LoadFromJSON(lResult, 'value');
      ThingsToDo.Visible := True;
    end
    else
      ThingsToDo.Visible := False;

  finally
    ThingsToDo.EndUpdate;
  end;
end;

Set a flag when form is loaded and only from there start to work with the form controls.
Also, the demo Demo\Basics\MultiForm shows how an await is used to start a new form, so code after the await can access controls on the form.

Thanks, that's sort of the approach I was thinking of. It's a little more complex (multiple awaits), but it I'll have a play. Thanks

Actually, it's not the form trying to access things before it's fully loaded. It's the other way round. It's the procedure trying to update controls after they have been destroyed (with the form).