OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
667 stars 95 forks source link

[PowerPoint-Web] : Parallel async calls to PowerPoint.run do not work #3952

Open jasonhieu1905 opened 8 months ago

jasonhieu1905 commented 8 months ago

Provide required information needed to triage your issue

Your Environment

Expected behavior

Context

We have an app for PowerPoint which is running well on PowerPoint on Windows and Mac but does not run on PowerPoint on Web because our code uses a lot of parallel PowerPoint.run calls. It is a lot of work for us to change the code so that it works also for PowerPoint Online. This is also causing our app to be rejected from the AppSource because it is not working in Online.

Current behavior

Steps to reproduce

  1. Execute multiple PowerPoint context asynchronously PowerPoint.run(async (context) {doSth()})
  2. Inside the callback, try to access the PowerPoint resource (e.g., get selected slideId from presentation).
  3. Compare the results between the Web and the App.

Link to live example(s)

https://gist.github.com/jasonhieu1905/f8ccf23c6a7c8614931281fde9b07777

Useful logs

See this line in the live example:

async function runParallel() {
  await Promise.all([getSelectedSlideId("1"), getSelectedSlideId("2")]);
}

async function runSequential() {
  await getSelectedSlideId("1");
   await getSelectedSlideId("2");
}

image

jasonhieu1905 commented 8 months ago

@stevefengjin : I've updated the title and context to make it clearer.

EsterBergen commented 8 months ago

Hi @jasonhieu1905 - thanks for raising this! We'll look into it and update you soon.

EsterBergen commented 7 months ago

@jasonhieu1905 - This is a limitation currently for PPT online. I have created a backlog item for this (8717922) and will update this post once more information is available. We appreciate your patience and value the feedback you provide!