From a2a6520a9203815d2236420248cb10ef1b412e4f Mon Sep 17 00:00:00 2001 From: Mike Tobia Date: Fri, 21 Aug 2020 13:53:25 -0400 Subject: [PATCH] fix(pwa): reset config when not supplied --- src/server/middleware/pwa/config.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/server/middleware/pwa/config.js b/src/server/middleware/pwa/config.js index 535eb98c0..cc1785140 100644 --- a/src/server/middleware/pwa/config.js +++ b/src/server/middleware/pwa/config.js @@ -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; @@ -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,