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

Commit

Permalink
fix(pwa): reset config when not supplied (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
Francois-Esquire authored Aug 24, 2020
1 parent 60825f8 commit 6784c7c
Showing 1 changed file with 7 additions and 8 deletions.
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

0 comments on commit 6784c7c

Please sign in to comment.