Unable to exit MultiViewerMode after clicking on second document(from multiviewer mode) and switching back to singleviewer-mode

WebViewer Version:
@pdftron/webviewer”: “^10.10.1”,

Do you have an issue with a specific file(s)?
Can you reproduce using one of our samples or online demos?
Are you using the WebViewer server? No
Does the issue only happen on certain browsers? No, appears on all browsers
Is your issue related to a front-end framework? yes, I am currently using angular
Is your issue related to annotations? No

Please give a brief summary of your issue:
(Think of this as an email subject)

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)
Once docviewer is into multiviewer mode, and I click on second document ie right most document and then switch back to single viewer mode, i get below error:

Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading ‘getAnnotationManager’)
TypeError: Cannot read properties of undefined (reading ‘getAnnotationManager’)
at bt (eventListener.js:19:39)

Please provide a link to a minimal sample where the issue is reproducible:

Hello shilpar,

Thank you for reaching out, can you provide a code snippet on how youre implementing WebViewer and the exact steps to reproduce this issue?

Best regards,
Tyler

We have two separate documents which are loaded side-by-side in a multiviewer mode. On click of button, we switch between multiviewer to single-viewer and vice versa using below line. this.instance.UI.disableFeatures([this.instance.UI.Feature.MultiViewerMode])
instance.UI.enableFeatures([instance.UI.Feature.MultiViewerMode]);

Below is the block of code used to render:

     function loadSideBySideDocuments(leftSideFile, rightSideFile) {
           this.sideBySideConfig = { leftSideFile, rightSideFile };
           this.setReadOnlyLike(true);
           this.setIsAdminUser(false);
           const docViewers = this.pdfInstance.Core.getDocumentViewers();
          for (const docViewer of docViewers) {
                       docViewer.closeDocument();
           } 
    const instance = this.pdfInstance;
    instance.UI.enableFeatures([instance.UI.Feature.MultiViewerMode]);
    instance.UI.disableFeatures([instance.UI.Feature.Annotations]);
    instance.UI.disableElements(['comparisonToggleButton', 'downloadButton', 'saveAsButton', 'rotateHeader', 'rotateCounterClockwiseButton', 'rotateClockwiseButton', 'viewControlsDivider2']);

    const leftSideDoc = await instance.Core.createDocument(leftSideFile.fileDownloadUrl, {
        withCredentials: true,
        filename: `hello`,
    });        

    await leftSideDoc.getDocumentCompletePromise();        

    const rightSideDoc = await instance.Core.createDocument(rightSideFile.fileDownloadUrl, {
        withCredentials: true,
        filename: `hey`,
    });      

    await rightSideDoc.getDocumentCompletePromise();  

    await instance.Core.getDocumentViewers()[0].loadDocument(leftSideDoc);
    await instance.Core.getDocumentViewers()[1].loadDocument(rightSideDoc);
}

Hello shilpar,

I dont see anything that could cause this error besides awaiting for the docment to be closed before opening a new one.
Try:

 for (const docViewer of docViewers) {
                       await docViewer.closeDocument();
           }

I also see you’re using await inside of a non-async function, do you not get an error when loading?
Best regards
Tyler