1

I have used MGT Person Control in my two SPFx web parts.

If I add the single web part on one page and another web part in another page, both web parts are working properly.

And if I add both the web parts on single page than first web part loading properly and second web part throwing below issue:

Original error: Failed to execute 'define' on 'CustomElementRegistry': the name "mgt-mock-provider" has already been used with this registry**.

  • Environment - SharePoint Online
  • Framework - React
  • SPFx Solution

Thank you in advance

2
  • Which version of SPFx & @microsoft/mgt, you are using? Commented Jun 25, 2021 at 8:25
  • Hi Ganesh, I am using below version SPFX : 1.11.0 MGT: 2.1.0 MGT-React:2.1.0
    – Dev Joshi
    Commented Jun 28, 2021 at 18:23

1 Answer 1

0

This is a issue with CustomElementRegistry. Seems like it has been resolved with latest updates to library.

Try importing below mgt imports are from:

@microsoft/mgt-spfx

OR

@microsoft/mgt-react/dist/es6/spfx

You can follow this thread for more information: [BUG] Multiple Web Parts with SharePoint Provider in the same page error

2
  • Hi Ganesh, Actually I am using below import import {Person , PersonCardInteraction } from '@microsoft/mgt-react'; I have also provide version of spfx and Mgt version above Thank you in advance
    – Dev Joshi
    Commented Jun 28, 2021 at 18:27
  • 1
    Did you try suggestions given in my answer & github issue link? Try importing from @microsoft/mgt-spfx OR @microsoft/mgt-react/dist/es6/spfx library instead of @microsoft/mgt-react. Commented Jun 29, 2021 at 3:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.