sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

1000 log messages "Icon being re-registered. Ignoring duplicate registration." using Fabric React in SPFX webpart solution

Open frevds opened this issue 8 years ago • 30 comments

I'm having a SPFX webpart solution using React and Fabric UI. In the browser log I get more than 1000 warnings about icons being re-registered. I attempted to deactivate these using the GlobalSettings for icons but that did not help.

Is this normal or am I having some ill-configured packages?

image

frevds avatar Nov 01 '18 20:11 frevds

If that is indeed the case for any solution made with Fabric in SharePoint, then Microsoft is not acting professionally here. We are developing solutions. It is hard to explain to our customers (big companies) to ignore 1000 ugly warnings in the log, and it is extremely annoying to have them in there (takes memory and time) and no way to disable them. If I want to debug my solutions in Edge, I have to wait 1 minute for my log messages to appear after all these warnings, due to the slow processing.

frevds avatar Nov 02 '18 10:11 frevds

Agreed, those warnings are very annoying during development...

salascz avatar Nov 05 '18 20:11 salascz

You mean they don't appear in production?

frevds avatar Nov 05 '18 23:11 frevds

Totally agree. These warnings suck up resources and lead to poor page load performance.

kciabc avatar Nov 05 '18 23:11 kciabc

I think this is a SharePoint Online issue, because in "native" pages it also shows the warnings. Even the new sharepoint admin page shows them shpadmin

pedropablo avatar Nov 07 '18 19:11 pedropablo

Interesting @pedropablo, thanks for pointing that out. It seems this is happening with every clientside page (e.g. when creating a Site Page in Pages). Apparently whenever the Fabric React bundle is loaded, since the icons were registered before by SharePoint natively. The Fabric GlobalSettings defaults for icons should be adjusted so that these warnings don't appear on the console.

frevds avatar Nov 07 '18 20:11 frevds

Agree. Needs to be a way to disable. I tried the suggestion from this article: https://github.com/OfficeDev/office-ui-fabric-react/wiki/Using-icons but first option doesn't seem to work and second option won't compile.

kingfu avatar Nov 08 '18 16:11 kingfu

As pointed out earlier this cannot possibly be done by us in the extension we control, since these warnings already occur on the SharePoint side when the ClientSidePage is loaded. This is what MS should add to their call to initializeIcons.

Both calls compile for me, none have any effect. I tried the same using the GlobalSettings class.

frevds avatar Nov 08 '18 20:11 frevds

@frevds the problem is that initializeIcons is being called multiple times. It is not pointless that there are complaints here; but something is causing an unanticipated behavior.

Whatever information you have to repro would be useful. Trying to get a dev here to help out on the SP side.

dzearing avatar Nov 08 '18 23:11 dzearing

@dzearing Yeah, a SP dev taking a look at it would be great. I do have these warnings in the log for a plain ClientSidePage (Site Pages library > New Site Page). Apparently SharePoint registers the icons on its own and then loads the Fabric UI react bundle separately and registering them again. What exactly goes on under the hood is anybody's guess.

On the Fabric side - would it be possible to have a time-based aggregation of these warnings? Instead of having literally 1000+ messages of the same wording in the log for each icon one could put 1 message with 1000 icon names in it. Particularly in the Edge browser it takes more than 1 minute to actually poll all those warnings into the console (making debugging annoying, for every time you refresh the page you have to wait 1min to find your own log messages).

frevds avatar Nov 09 '18 00:11 frevds

I am literally working on this fix right now; pr out shortly.

dzearing avatar Nov 09 '18 00:11 dzearing

Great, looking forward to it.. which reminds me, this won't be coming straight into SharePoint anytime soon I'm afraid. But good to know that eventually it will.

frevds avatar Nov 09 '18 00:11 frevds

Separately, there are devs now investigating on the sppages side to identify root cause.

dzearing avatar Nov 09 '18 00:11 dzearing

The fix will be published in Fabric 6 tonight; I'm looking at cherrypicking into 5 and seeing if we can get that rolling if the devs investigating don't find the root cause sooner.

dzearing avatar Nov 09 '18 01:11 dzearing

@dzearing Fabric 6 is not supported in spfx 1.6+. Is there any other alternatives to get rid of these warnings as it is impacting the page performance in production.

MaheshakaMudli avatar Nov 20 '18 07:11 MaheshakaMudli

SP 2016 is using SPFx 1.1.0 and office-ui-fabric-react 2.31.0. This issue exist there too. What is its possible solution?

AteetAgarwal avatar Nov 23 '18 07:11 AteetAgarwal

I have the same problem, the more than 1000 warnings come from this js: https://spoprod-a.akamaihd.net/files/sp-client-prod_2018-11-09.013/office-ui-fabric-react-bundle_71d81bf8e2308355fb1b83074045e6a9.js I use spfx with different versions 1.7 and 1.1.

magonzalezm avatar Nov 27 '18 17:11 magonzalezm

The issue has been solved already on Fabric side. Now we have to wait till SharePoint guys updates their packages on their side...

salascz avatar Nov 27 '18 18:11 salascz

I followed the blog https://github.com/OfficeDev/officev-ui-fabric-react/wiki/Using-icons to fix the issue. SPFx v1.1.0 doesn't support these classes, so tried with v 1.7.0 but that doesn't solve the issue.

AteetAgarwal avatar Nov 28 '18 06:11 AteetAgarwal

Well I got those warnings even for empty workbench page...

Your issue might not be caused by your code.

Actually, I do not know about any way, how to force the rest of the SharePoint page to use updated Fabric even when you use it for your code...

salascz avatar Nov 28 '18 08:11 salascz