As of today, we notice on some tenants that application customizers are added multiple times to pages.
Here is an example of navigating seven times:

What is worse is that this seem to be caused for everything on the page. So also for the style elements which get added by SPFx solutions.
Initial page load;

After navigating seven times:

My solution only adds one to a page.
Check above.
Using the following guide and navigating to other pages will cause this behaviour: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/using-page-placeholder-with-extensions
A quick workaround would be to change the private class variables to static class variables. Which is what @waldekmastykarz and I tested.
I am seeing the same issue on multiple tenants. This is a serious issue, please fix it and start testing your stuff before pushing it out to the customers.
I was about to report the exact same issue!
We're having the same issue. I believe this was previously fixed in #1464 but has reappeared today.
As a workaround I am checking if my menu component already exists in the header with the following:
const menuCheck = document.getElementById("swlstgMenu");
if (this.topPlaceholder.domElement && !menuCheck) {
...
}
@rmillener if you create topPlaceholder as a static variable it should also work.
So instead of doing this:
export default class CustomApplicationCustomizer extends BaseApplicationCustomizer<ICustomApplicationCustomizerProperties> {
private topPlaceholder: PlaceholderContent;
You can change it as follows:
export default class CustomApplicationCustomizer extends BaseApplicationCustomizer<ICustomApplicationCustomizerProperties> {
private static topPlaceholder: PlaceholderContent;
And you will have to update this.topPlaceholder to CustomApplicationCustomizer.topPlaceholder.
Thanks Elio, a much better solution.
Digging into this. Does it happen on lists and pages, or just pages?
@patmill Both, just checked. It seems to happen every time the page is changed without the browser refreshing.
Only happens when the browser doesn't do a full page refresh. In my case, every time I navigate to the document library, it triggers a full refresh, so it is good.
If you navigate between two libraries or lists the same thing happens. So it is not only on pages...
Ok, in the process of rolling out a fix. There was a checkin timing issue on the original fix. Will be working to avoid that in the future.
Apologies.
Pat
From: OliverZeiser notifications@github.com
Sent: Tuesday, March 27, 2018 10:44:44 AM
To: SharePoint/sp-dev-docs
Cc: Pat Miller (SHAREPOINT); Mention
Subject: Re: [SharePoint/sp-dev-docs] Navigating to pages within the same site causes the application customizer to bind multiple times (#1546)
If you navigate between two libraries or lists the same thing happens. So it is not only on pages...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FSharePoint%2Fsp-dev-docs%2Fissues%2F1546%23issuecomment-376613482&data=02%7C01%7CPat.Miller%40microsoft.com%7C3da235199dc1447677a808d5940a6def%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636577694871346725&sdata=sOl9Aks7XeN9C2UKVG0A6qokiAm7pMg8e5HLbogx0r4%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FADl-SeFPPkbxQj7LddLDA2gBrlC2NCs9ks5tinqMgaJpZM4S8wkx&data=02%7C01%7CPat.Miller%40microsoft.com%7C3da235199dc1447677a808d5940a6def%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636577694871346725&sdata=Jxtd89HKFL7wXOdg0qGNb8ZZdcPDWTlNbhwtrceZCtA%3D&reserved=0.
@patmill Any idea when we can expect a fix for this? I have also noticed that when using the back and forward buttons that lead to a completely different SharePoint site, the placeholders remain even though on the site you navigated to the placeholders should not appear.
Most helpful comment
Ok, in the process of rolling out a fix. There was a checkin timing issue on the original fix. Will be working to avoid that in the future.
Apologies.
Pat
From: OliverZeiser notifications@github.com
Sent: Tuesday, March 27, 2018 10:44:44 AM
To: SharePoint/sp-dev-docs
Cc: Pat Miller (SHAREPOINT); Mention
Subject: Re: [SharePoint/sp-dev-docs] Navigating to pages within the same site causes the application customizer to bind multiple times (#1546)
If you navigate between two libraries or lists the same thing happens. So it is not only on pages...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FSharePoint%2Fsp-dev-docs%2Fissues%2F1546%23issuecomment-376613482&data=02%7C01%7CPat.Miller%40microsoft.com%7C3da235199dc1447677a808d5940a6def%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636577694871346725&sdata=sOl9Aks7XeN9C2UKVG0A6qokiAm7pMg8e5HLbogx0r4%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FADl-SeFPPkbxQj7LddLDA2gBrlC2NCs9ks5tinqMgaJpZM4S8wkx&data=02%7C01%7CPat.Miller%40microsoft.com%7C3da235199dc1447677a808d5940a6def%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636577694871346725&sdata=Jxtd89HKFL7wXOdg0qGNb8ZZdcPDWTlNbhwtrceZCtA%3D&reserved=0.