Is there a way to retrieve the currently active hash of my Angular PWA without waiting for an event trigger?
While the SwUpdate object offers observables for accessing the hash when a new version is activated or becomes available, it does not seem to provide a method for getting the hash of the current version statically.
class SwUpdate {
available: Observable<UpdateAvailableEvent>
activated: Observable<UpdateActivatedEvent>
unrecoverable: Observable<UnrecoverableStateEvent>
isEnabled: boolean
checkForUpdate(): Promise<void>
activateUpdate(): Promise<void>
}
I am looking for something like SwUpdate.current
to get the current hash value (e.g.
a518f9f1ab65954c2eafa02fec134fa54b391651
) without relying on an available
or activated
event. Is this feasible?
Addendum
Although I couldn't find a solution through official channels, I managed to address this issue by creating a custom hash version for the app during the CI build process. This was stored in a JSON file within the app and used as the app version's hash instead of the Angular-generated one. So far, this workaround has been effective.