shadowwalker / next-pwa

Zero config PWA plugin for Next.js, with workbox 🧰
MIT License
3.75k stars 311 forks source link

getServerSideProps with next-pwa runs multiple times on server #432

Closed kruzliak-juraj closed 1 year ago

kruzliak-juraj commented 1 year ago

I have a very simple /pages structure:

/pages
  index.tsx
  [...complexPostSlug].tsx
  /category
    [slug].tsx

When using withPWA alongside getServerSideProps on all of these pages, simple console.log at the beginning of getServerSideProps reveals that the function inside gets executed twice for the page I am navigated at.

This causes issues because if I have API calls in there, they get executed twice.

None of these happen without next-pwa implemented. Tested also on a fresh install of nextjs, latest 13.0.3.

kruzliak-juraj commented 1 year ago

Also happens on a clean install of the latest version of next v12

Also happens with getInitialProps

kruzliak-juraj commented 1 year ago

https://github.com/shadowwalker/next-pwa/issues/435