Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

159
Visualizações
Invalidate Angular service worker / force update server side

Is there any way to force users to reload my web application and get around local service worker, maybe via some configuration on my webserver (nginx) or any other means?

Background: I have a bit of a problem: I have an angular application with service worker, that is already cached on peoples machines. The code below shows, how it checkes for updades, displays and update message and then does the update, once the update message is dismissed. Unfortunately there is Bug in the update message (snackbarService.showVersionUpdate()) that updates.activateUpdate() is never called. So the old, cached frontend version is used until the browser window is closed and reopened or reloaded with Ctrl+F5.

The problem is, all fixes to the code only come into effect after an update of the service worker, which itself is the problem.

constructor(updates: SwUpdate, snackbarService: SnackbarService) {
    updates.checkForUpdate();
    updates.available.subscribe(event => {
        // Show snackbar
        const snackBar = snackbarService.showVersionUpdate();
        snackBar.afterDismissed().subscribe(() => {
            updates.activateUpdate().then(() => {
                window.location.reload();
            });
        });
    });
}

I am grateful for any solutions or ideas!

Edit: I found this answer, which talks about updating the service worker itself. Does anyone know how to do that with the angular service worker?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda