Background tasks from dependencies inconsistently listed

I was testing what has changed after this was implemented, and I noticed that the list of background tasks defined in the dependencies often appears “late”.

  1. create a new app M3 App 1
  2. add ServerModule1
  3. define the background task hello
  4. create a second app M3 App 2
  5. add M3_App_1 as a dependency
  6. add the Scheduled tasks service
  7. try to add a scheduled task → it says You have no background tasks - bad
  8. refresh the browser and try again → it says You have no background tasks - bad
  9. run and stop the app, and try again → hello (M3_App_1.ServerModule1) is listed - good
  10. refresh the browser and try again → it says You have no background tasks - bad
  11. click Discard to close the dialog and try again → hello (M3_App_1.ServerModule1) is listed - good

I went through this testing because I was trying to reproduce the behavior of a production app that shows the same background task twice, but I wasn’t able:
image