It's important to note that there is a distinction between the functions activated
and activateUpdate()
. When you trigger activateUpdate()
, it initiates the process, and once completed, activated
occurs.
Additionally, it's crucial to differentiate between activated
and available
(both mentioned in your inquiry). While available
indicates an update has been detected, activated
signifies that it has been successfully installed.
As stated in the documentation (https://angular.io/api/service-worker/SwUpdate), the recommended approach for replacing available
is as follows:
import {filter, map} from 'rxjs/operators';
// ...
const updatesAvailable = swUpdate.versionUpdates.pipe(
filter((evt): evt is VersionReadyEvent => evt.type === 'VERSION_READY'),
map(evt => ({
type: 'UPDATE_AVAILABLE',
current: evt.currentVersion,
available: evt.latestVersion,
})));