microsoft-graph-toolkit icon indicating copy to clipboard operation
microsoft-graph-toolkit copied to clipboard

Use MGT in SharePoint tenants with and without the mgt-spfx library package installed

Open MarksPoint opened this issue 2 years ago • 3 comments

We have the following situation:

  • Our SharePoint solution, Ichicraft Boards, relies on MGT (mgt-react) for one of its components
  • The version of MGT we use is currently bundled together with the solution, so it's part of the JavaScript bundle used by our solution
  • We've been using it this way for over a year and back when we initially built the solution, the mgt-spfx library package wasn't available yet
  • Our solution is installed in many tenants (> 100)
  • One of our customers installed another 3rd party solution that's also depending on MGT, but this solution is using the mgt-spfx library
  • Our solution currently breaks because it tries to install the same MGT web components as the library used by the other 3rd party solution
  • Ignoring the error the browser raises when trying to install web components that have already been installed, doesn't completely solve the issue. It suppresses the error but the component we try to use (mgt-person-card in this case) doesn't load.

How would we go about building our solution in such a way that it uses the mgt-spfx library package when it's installed, but uses the bundled mgt-react library otherwise?

Please note that updating our solution to always use the mgt-spfx library isn't feasible since we'd have to update > 100 installations done by many different parties.

MarksPoint avatar Jul 14 '22 14:07 MarksPoint

Hello MarksPoint, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

ghost avatar Jul 14 '22 14:07 ghost

Thanks @MarksPoint for the issue. We have been investigating and this would be part of our v3 milestone (later this year). We want to provide more granularity in the names of the components to potentially avoid the mgt-spfx package. For now, the request would be to use mgt-spfx as the supported option for SPFx development to avoid collisions.

Thanks!

sebastienlevert avatar Jul 15 '22 13:07 sebastienlevert

Adding an additional point on mgt-spfx this solution requires that all customizations built using mgt use mgt-spfx. Otherwise, there are still going to be multiple attempts to register the custom element.

gavinbarron avatar Sep 01 '22 18:09 gavinbarron

This will be supported as part of our v3 release. It was already merged in out next/fluentui branch if you want to take a look. The only requirement will be to utilize v3 and stop using v2 for this use case.

sebastienlevert avatar Feb 06 '23 15:02 sebastienlevert