I finally figured out what is going on. There are some problems with PWA, but I’m not sure there are solutions or a need for one. But it sure is an annoyance. I just made a major change in a project’s file structure and another related issue came up and I realized what was going on with this issue as well.
PWA uses cache to start the program, and then checks with the server later to see if there is any file that has changed verses what is in the cache. If one or more files changed, then these files are downloaded, and the program restarts with the fresh copy (assuming you haven’t captured the onPWAreload() event).
But, when you start in desktop browser (SIDB), it’s a little different. This scenario is quite annoying: First, start the app with SIDB, leave AppStudio (AS) and chrome open, and SIDB the project again. The index.html file appears as a new file to chrome, even though it hasn’t been changed, and this should trigger the PWA to reload, even though there were not any changes. Not sure this is a problem, but …
Starting the SIDB the second time causes AS to send a fresh copy of index.html to chrome with a navigate parameter, so the index.html file is loaded immediately. The rest of the files would normally be loaded by index.html, but this is a pwa, so that is delayed. (Edit: It is not delayed, the reload is never fired. I’m not sure why it doesn’t fire consistently.) So now you are running with a fresh copy of the index.html with stale copies of the rest of the app. So if the change you just made was in one of those stale copies, it makes it appear your change didn’t work. You start checking the obvious, but not the source - only to find you need to reload again.
In my case, I had consolidated 6 .js files into one .js file. The other five were missing and those variable definitions caused errors. This caused a full app halt and the realization of what was happening.
This has bothered me as I was not sure why this was happening and hoping it would not/could not happen in the field. Now I know that it won’t, it is just the nature of SIDB. Hope this info helps someone else whose been scratching their heads. Maybe a resolution to this can be addressed?