I've an Angular PWA with refreshing problem. I have a TAB disabled.
<nz-collapse-panel [nzActive]="false" [nzDisabled]="true">
Now on the code i set this tab to enabled and build the solution and deployed on the webspace.
<nz-collapse-panel [nzActive]="false" [nzDisabled]="false">
If a go to the PWA and refresh, this Collapse remain disabled. I must reload the page more and more time and at the end, the Tab is enabled.
I close and reopen the app, the tab is disabled...
The data is correct and refreshed. It seem's only the HTML is using some cache that is not refreshed.
The strange thing is that after reload the page more time, the TAB become enabled (so i think have update the cache) and when reopen the app, the TAB is disabled again.
Also the menù doesn't refresh the list. It seems only html element's are not refreshing.
My configuration is with Angular 11 with Ng-Zorro
P.s Obviously if i go on browser on Developer Tool -> Application -> Delete site data, the cache is cleared and the PWA is Updated but on mobile phone i can't and i don't want to do this
This is my ngsw file:
{
"version": 3,
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": ["/favicon.ico", "/index.html", "/manifest.webmanifest", "/*.css", "/*.js"]
}
},
{
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": ["/assets/**", "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"]
}
}
],
"cacheConfig": {
"strategy": "freshness"
}
}
and my appcomponent file
constructor(public baseService: BaseService, public webapi: WebapiService, private swUpdate: SwUpdate) {
this.baseService.initialize();
this.baseService.setWidth(window.innerWidth);
//#region Check for updates
if (this.swUpdate.isEnabled) {
this.swUpdate.activated.subscribe((upd) => {
window.location.reload();
});
this.swUpdate.available.subscribe(
(upd) => {
this.swUpdate.activateUpdate();
},
(error) => {
console.error(error);
}
);
this.swUpdate
.checkForUpdate()
.then(() => {})
.catch((error) => {
console.error('Could not check for app updates', error);
});
}
//#endregion
}