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
670 stars 96 forks source link

Pane not always closing properly #3144

Open YossiCohen opened 1 year ago

YossiCohen commented 1 year ago

When I update the worksheet multiple times with setInterval sometimes closing the pane doesn't stop the setInterval functionality. a very basic example can be found here: https://github.com/YossiCohen/office-js-pane-not-closing-bug

Your Environment

Expected behavior

When I close the pane - all the related functionality should be stopped

Current behavior

If there is a single interval-related pane - closing it will stop the setInterval functionality. If there is another pane open when closing the pane with the setInterval - it will continue to run until reopening the interval pane again.

Steps to reproduce

The STR refers to the 2 panes in the example in the link, generally "highlight" is a basic pane and "interval-update pane" is a pane with setInterval functionality.

there are 3 different scenarions: scenario A:

  1. Open the "interval update pane"
  2. Click the "Random interval!" button (see how values change rapidly in the active worksheet)
  3. Close the "interval update pane" Result: Values stop changing rapidly

Senario B:

  1. Open the "Highlight pane"
  2. Open the "Interval update pane"
  3. Click the "Random interval!" button (see how values change rapidly in the active worksheet) Mid-step-result: Values keep on changing rapidly
  4. Close the "Interval update pane" Mid-step-result: Values keep on changing rapidly
  5. Close the "Highlight pane" Mid-step-result: Values keep on changing rapidly
  6. Open the "Highlight pane" Mid-step-result: Values keep on changing rapidly
  7. Close the "Highlight pane" Mid-step-result: Values keep on changing rapidly
  8. Open the "interval update pane" Result: Values stop changing rapidly

Scenario C:

  1. Open the "Highlight pane"
  2. Open the "Interval update pane"
  3. Click the "Random interval!" button (see how values change rapidly in the active worksheet) Mid-step-result: Values keep on changing rapidly
  4. Close the "Highlight pane" Mid-step-result: Values keep on changing rapidly
  5. Open the "Interval update pane" Result: Values stop changing rapidly

Link to live example(s)

you can simply deploy this project: https://github.com/YossiCohen/office-js-pane-not-closing-bug

Provide additional details

none

Context

sometimes I have an external source of data the populates the worksheet with multiple HTTP calls, if I close the pane I want the update to stop. My adding has more than one pane so I want it to stop even if there is another pane open. I tried to work around this issue with trying to catch the close even of the pane but couldn't this is a SO question related: https://stackoverflow.com/questions/75405095/pane-not-closing-properly-in-excel-js-addin

Useful logs

Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.

ghost commented 1 year ago

Thank you for letting us know about this issue. We will take a look shortly. Thanks.

ruijiaMS commented 1 year ago

Hi @YossiCohen Thanks for your patient here! We test it on latest production environment and cannot reproduce this issue. Our Office version is: 16.0.16130.20122 and the following record is showing our repro steps. Could you please update to the latest Office version to test it and confirm our repro steps are the same with yours? https://user-images.githubusercontent.com/113165331/219529936-1b7bb08d-9eb9-4bb6-8a4b-b39b4adb29a1.mp4

YossiCohen commented 1 year ago

Hi @ruijiaMS, Thanks for the detailed response. My version is: Version 2202 Build 16.0.14931.20648, it still reproduces on this version. When I try to update my Office I get this message: image Would you happen to know why I can't update? Does it related to the fact that I'm using the enterprise version?