Skip to content

refreshAheadMs missing on serviceWorker config #46729

@yelhouti

Description

@yelhouti

Which @angular/* package(s) are relevant/related to the feature request?

service-worker

Description

The option refreshAheadMs is not copied to the the ngsw.json in this code:

private processDataGroups(config: Config): Object[] {
return (config.dataGroups || []).map(group => {
return {
name: group.name,
patterns: group.urls.map(url => urlToRegex(url, this.baseHref, true)),
strategy: group.cacheConfig.strategy || 'performance',
maxSize: group.cacheConfig.maxSize,
maxAge: parseDurationToMs(group.cacheConfig.maxAge),
timeoutMs: group.cacheConfig.timeout && parseDurationToMs(group.cacheConfig.timeout),
cacheOpaqueResponses: group.cacheConfig.cacheOpaqueResponses,
cacheQueryOptions: buildCacheQueryOptions(group.cacheQueryOptions),
version: group.version !== undefined ? group.version : 1,
};
});
}

Proposed solution

Add it there and the schema https://github.com/angular/angular/blob/253ac15ae89755f6830f3cf567c80de20d013663/packages/service-worker/config/schema.json

Alternatives considered

Have a block that is copied as is or have fields modified without recreating the config to avoid issues when new features are added to the service worker config. ie: clone the object before modifying it (calling parseDurationToMs...) to avoid loosing options... and have a looser schema

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: service-workerIssues related to the @angular/service-worker packagefeatureIssue that requests a new featurehelp wantedAn issue that is suitable for a community contributor (based on its complexity/scope).

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions