We have created a WebPart to render as an application page, so we leave the supportedHosts in the manifest.json empty and use the apppagehost.aspx URL to render our WebPart. The url looks like this: {siteUrl}/_layouts/15/appPageHost.aspx?componentId={componentId}.
This method worked well for a long time, now we have a problem with our first release tenant, where the WebPart is removed after a few seconds.
Create a new WebPart with SPFx version 1.8.2 and use the apppagehost.aspx page to render your WebPart. Our tenant is running in the first release mode, it seems like that the other tenants are not affected.
Open the URL and the WebPart will be rendered:

After a few seconds:

Html here looks like there should be a loading spinner...

I debuged a little bit in the SharePoint js files and found a file https://spoprod-a.akamaihd.net/files/sp-client/sp-pages-assembly_en-us_6c1243ef07241a9f41fe54d8c7adbc98.js which probably causes the issue. In this script a _clearChildren function is called that removes the content of the web part.

Any Suggestions what we could do to make it work again?
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
Unless I'm mistaken, what you're doing isn't a supported scenario. That page is used to host components as tabs in Microsoft Teams. MSFT may have added logic to clear the page if a Teams context isn't detected to remove it from the page.
You may try using the current version of SPFx 1.9.1, but pretty sure this scenario isn't supported. The other option would be to set it as a full page app page to see if that works for your scenario.
Hmm I think that for the teams tabs teamshostedapp.aspx is used. In the SPFx 1.8 release notes MSFT announced that there is a static page under appPageHost.aspx that will host any component in an app page - https://github.com/SharePoint/sp-dev-docs/wiki/SharePoint-Framework-v1.8-release-notes#app-pages - We have been using this page for almost half a year and it has always worked very well.
If we set it as a full page app page, do we need to add a page to each site collection to have this app page avaiable? That was the big advantage from the apppagehost.aspx, which is already on every site and we can simply render our component there.
@db3005 - correct. This should be supported, and you don't need to create a one-off app page .aspx in the sitepages library per site. As to why the spinner clearing is removing it - that sounds like a bug.
Are you by any chance doing rendering inside your onInit function (or in a promise resolved by your onInit function)?
@patmill - No, I start my rendering only in the render function. Even if I render a single div, it will be removed after 4-6 seconds.

->

Could it relate to the webpart properties panel ? In my issue #5019 I found out that I can't view the properties panel after those webparts disappeared.
If I click on normal ootb webparts they show properties panel just fine, and if I click back on my custom webpart it will still show the properties panel but after I save the page and refresh, the properties panel cannot be opened again and the wp will disappear from the page.
@patmill @andrewconnell - Any updates on this issue?
@patmill Any updates on this? This problem has reached our productive tenants.
We created a ticket yesterday and the support engineer told us that this topic is being worked on but he could not give and eta or an internal id for this problem.
This issue has been fixed and will be part of the next prod rollout.
@kemesfun The accepted practice in this repo is to leave issues open until the fix is actually implemented & confirmed resolved by the OP (/cc @VesaJuvonen)
Has the prod rollout already happened? We just retested this and is still not working.
@MrTantum Can you give more details of which release tenant you are on. I am getting an error now, but it is related to preloaded information on page and not with the webpart.
It is a pre-release tenant:

Tenant ID is: b92496b8-2082-44c9-8996-26a1d0e8e3f8
This is happening in my production. Not sure if relating to this but my custom web part disappear right after added to the page.
I recorded the screen for more defails: https://youtu.be/-2UWAyXuZTY
@OverkillTV I couldn't repro this issue using a prod tenant.
The issue that I get is 'TypeError: Cannot read property 'Content' of undefined'. This is a new issue and isn't related to the original issue
@db3005 can you confirm the issue has been resolved? MSFT (@kemesfun) stated the fix has been applied and rolledout.
@andrewconnell No, unfortunately the error still occurs. I created another standard SPFx WebPart without any changes and recorded the screen:

@OverkillTV I couldn't repro this issue using a prod tenant.
The issue that I get is 'TypeError: Cannot read property 'Content' of undefined'. This is a new issue and isn't related to the original issue
Yeah I have 2 prod tenants. One has this issue, the other doesn't so not really sure why. They are in standard release.
@db3005 can you do the following commands: ctrl-shift-f12. I want to see which version of sp-client you are using because it is likely that the farm that you are didn't receive the code changes that were made that resolved this issue.
@OverkillTV It could be that your prod tenants are on two separate farms, so one has the newer code and the other doesn't. Can you confirm this?
@kemesfun here's the screenshot:

Is that enough for you to see the version?
@db3005 can you do the following commands: ctrl-shift-f12. I want to see which version of sp-client you are using because it is likely that the farm that you are didn't receive the code changes that were made that resolved this issue.
@OverkillTV It could be that your prod tenants are on two separate farms, so one has the newer code and the other doesn't. Can you confirm this?
Yeah they are in different farms. But not sure how to check if one has newer than the other.
@db3005 sorry I forgot to ask you to click performance, you should see client version.
@OverkillTV running the command: ctrl-shift-f12, then clicking performance should show which version of sp-client you are on. This can verify that one farm has the newer code than the other.
@kemesfun : They are in different version as well. Here is the screenshot:
Issued one:

No issue one:

@kemesfun For me it is exactly the opposite, version sp-client-prod_2020-03-13.002 causes the issue

@db3005 @OverkillTV The reason for this can be because a Flight is on. Can you search for the method _renderWebPartOld? If this doesn't exist then the Flight is on.
undefined in console or am I suppose to search in any specific files ?
@OverkillTV Hit F12 (go to the console) and hit ctrl+shit+f and search for the file that has this. If it doesn't show, then the Flight is on.
There is file that contains the _renderWebPartOld

@OverkillTV can you add a breakpoint on that method, it shouldn't hit it since that was the part that was causing the webpart disappearing. It should hit _renderWebPart.
@OverkillTV can you add a breakpoint on that method, it shouldn't hit it since that was the part that was causing the webpart disappearing. It should hit _renderWebPart.
The script file is too big for my chrome so it hung up.
So I used Google Chrome Canary instead to step in and surprisingly the _renderWebPartOld doesn't show up in any files when I search. I tried with _renderWebPart and it indeed hit the _renderWebPart line of code.
@OverkillTV This means that your tenant doesn't have the fix for this issue. The _renderWebPartOld indicates that the older logic from _renderWebPart ( the one that you are seeing) was added to it and so the current _renderWebPart in master has different logic than the _renderWebPartOld. Because you only have _renderWebPart that means that you still have the older code.
@kemesfun I could find the _renderWebpartOld Method in the sp-pages-assembly file. At least in Firefox I could add a breakpoint and the method will be executed. How can we fix this?

@db3005 what stage is your farm, that your tenant is in, on? I want to confirm that the flight stage equals your farm stage.
@kemesfun its a pre release tenant:

I am seeing the same issue. But on the same tenant, sometimes it works and sometimes it does not. But when adding this URL as an Iframe e.g. as a MS Teams Tab, then I can reproduce the issue every time.
Not sure if that helps to track down the issue, but it seems to be consistent and reproducable when the layouts Page is beeing displayed in an iframe.
What seems to be the case is that the flight doesn't hit all tenants. We will be making changes to solve this issue since the flight will take a while to get approved and reach all tenants.
@kemesfun Will that fix also work when hosting appPageHost.aspx in an iframe? Do you have any estimate time when this fix will be deployed worldwide?
@OliverZeiser yes it should work in an iFrame. The fix has been made, and will come out when our next rollout happens. I don't have a estimate time since rollouts can't be halted for various reasons.