Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

fix(pwa): reset config when not supplied #283

Merged
merged 1 commit into from
Aug 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/server/middleware/pwa/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ function setPWAConfig(newConfiguration) {
}

function createServiceWorkerConfig(config) {
if (!config) {
// if there was no config given or a previous configuration present, we want to
// gracefully remove any remaining instances. We currently handle this client side
// and would only need to reset the configuration when we want to decouple.
return resetPWAConfig();
}

let enabled = false;
let scope = null;
let type = null;
Expand Down Expand Up @@ -111,14 +118,6 @@ export function configurePWA(config = {}) {
config = null;
}

if (!config && pwaConfig.serviceWorker) {
// if there was a previous configuration present, we want to gracefully
// remove any remaining instances. We currently handle this client side
// and would only need to reset the configuration when we want to decouple.
// eslint-disable-next-line no-param-reassign
config = resetPWAConfig();
}

const serviceWorkerConfig = createServiceWorkerConfig(config);
const {
webManifestObject, webManifest,
Expand Down