Outlook 365 dialog open for too long crashes outlook addin
Asked Answered
A

0

6

I have set up a very simple functions.html which launches a likewise simple dialog that only registers Office.initialize with a console log. If left open too long I get a large error in the console and the dialog becomes unclosable except by refresh.

Is this a known issue or is there something i need to be doing differently?

dialog.html

<!DOCTYPE html>
<html lang="en" style="height: 100%">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="theme-color" content="#000000">

    <link rel="manifest" href="%PUBLIC_URL%/manifest.json">
    <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">

    <script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"></script>
    <title>React App</title>
    <script>
        Office.initialize = x => {
            console.log('initialized')
        }
    </script>
  </head>
  <body style="height: 100%">
  yo stuff
</body>
</html>

my js looks like this

export const showSmsModal = () => {
    officeCtx().ui.displayDialogAsync(`${window.location.origin}/test.html`, {displayInIframe: true, height: 40, width: 40}, ({ value: dialog }) => {
        console.log(dialog)
        return dialog
    })
}

and part of the error i get is the following:

Uncaught Exception in t(t){var o=e.call(this,t)||this;return o._warnDeprecations({onLayerMounted:"onLayerDidMount"}),o.props.hostId&&(u[o.props.hostId]||(u[o.props.hostId]=[]),u[o.props.hostId].push.componentWillUnmount(): TypeError: Cannot read property 'extension' of null at Object.o [as default] (https://r4.res.office365.com/owa/prem/16.2478.1.2588899/scripts/owa.clientnext.extensibility.js:2:16883) at e.refCallback (https://r4.res.office365.com/owa/prem/16.2478.1.2588899/scripts/owa.clientnext.extensibility.js:7:15203) at r (https://r4.res.office365.com/owa/prem/16.2478.1.2588899/scripts/owa.clientnext.application.js:94:3330) at Object.a.detachRefs (https://r4.res.office365.com/owa/prem/16.2478.1.2588899/scripts/owa.clientnext.application.js:94:3783)

It appears that the hidden iframe which is used to call the showDialog function goes away and the dialog iframe is unable to communicate with it and interval console logs i set up seem to stop from it.

I would expect it to close both iframes.

Amanda answered 31/7, 2018 at 21:50 Comment(2)
so far my work around is to set a timeout for 4 minutes and dialog.close(); window.close() in the functions fileAmanda
Not sure if this is helpful, but: 1.) Have you tested to see if your outlook crashes on other addins when they are left open? 2.) Does the tutorial addin work/crash similarly on your machine?Twinflower

© 2022 - 2024 — McMap. All rights reserved.