SharePoint Online : yo @microsoft/sharepoint issue for BaseDialog API

prithavi 0 Reputation points
2023-02-06T22:40:06.7366667+00:00

SharePoint issue

I developed sharepoint spfx extension for sharepoint online and created project through yeoman generator. From 2 years BaseDialog was showing properly and now sudden change from backend BaseDialog is showing abnormal behavior. It is working fine while opening the BaseDialog for the first time and disappearing for the second time. Due to this I am losing business with my client and trust in Microsoft cloud products.

Below the environment details. 
+-- Node 16.14 
+-- @microsoft/generator-sharepoint@1.16.1
+-- generator-office@1.9.2
+-- gulp-cli@2.3.0
+-- yo@4.3.1 

Code snippet: 

  var dialog_1 = new CustomDialog();
          dialog_1.show().then(function () {
          });
       

 import { BaseDialog } from '@microsoft/sp-dialog';   
export default class CustomDialog  extends BaseDialog{
        public render(): void {  
            this.domElement.innerHTML=<h1> Hello World </h1>;
        }
    } 
 
SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,422 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,230 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,454 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,642 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,006 Reputation points Microsoft External Staff
    2023-02-07T03:03:23.96+00:00

    Hi @prithavi

    Have you tried to close and clean the first BaseDialog? You can add following code after close the BaseDialog.

    protected onAfterClose(): void;
    
    

    The dialog lifecycle completes after closing and there should be no resources left inside the object. Even though the dialog may be revived again for a new lifecycle using show() method, this is considered a whole new lifecycle that should reallocate its own resources. If there are any resources that you would like to keep for multiple lifecycles, consider allocating it outside the dialog object and passing its reference to the dialog constructor.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.