lukeed / pwa

(WIP) Universal PWA Builder
https://pwa.cafe
3.13k stars 100 forks source link

Duplicated App in svelte production #68

Closed pupubird closed 4 years ago

pupubird commented 4 years ago

Hi! I am trying out this exciting project for Svelte! The step to recreate the issue:

Environment: Chrome, svelte with route and offline-plugin

  1. go to any route
  2. hits the refresh button
  3. And I will see the duplicated app like this

It works fine if I directly land on the page, image

but when I hit the refresh button, it will be duplicated

image

Some information that I think might help:

  1. If I run npm run build again, the amount of duplicated = the amount of time I run the command
  2. Only home page won't have this issue, other pages will have this issue

I tried:

  1. delete the build folder and run again
  2. clear all data in chrome

May I know how should I resolve this issue? Very much thanks

lukeed commented 4 years ago

Hey, thanks for raising an issue!

Looks like the svelte template is missing this within the src/index.js file:

window.app = new App({
    // ...
    hydrate: true // <~ add this
});

Verified it on my end. Please let me know if it works for you

pupubird commented 4 years ago

The duplicated app issue is gone! Thanksss!!!