Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search for an active next-pwa fork #482

Open
coopbri opened this issue Jun 5, 2023 · 2 comments
Open

Search for an active next-pwa fork #482

coopbri opened this issue Jun 5, 2023 · 2 comments

Comments

@coopbri
Copy link

coopbri commented Jun 5, 2023

Since this library is abandoned but extremely useful, I am on the hunt for an active fork. I'm not sure if there's a single community-recognized fork here, but I think it would be useful to come together and aggregate on a single one.

Popular active forks I've discovered:

If you are aware of others (or have a preference of the ones listed above), please let me know.

@angelhodar
Copy link

I have commented a thread in the nextjs github discussions about the idea of including PWA support in the framework like they have done with next-seo by adding the Metadata API: vercel/next.js#42676

@coopbri
Copy link
Author

coopbri commented Jun 16, 2023

@angelhodar That's excellent! I think first-class Next.js support would be great. Thanks for linking. Your thoughts about iOS 16.4 Web Push are exactly what catalyzed me to look for an active fork.

ekzyis added a commit to ekzyis/stacker.news that referenced this issue Jun 19, 2023
next-pwa was last updated in August 2022.
There is also an issue which mentions that next-pwa is abandoned (?): shadowwalker/next-pwa#482

But the main reason for me uninstalling it is that it adds a lot of preconfigured stuff which is not necessary for us.
It even lead to a bug since pages were cached without our knowledge.

So I will go with a different PWA approach. This different approach should do the following:
- make it more transparent what the service worker is doing
- gives us more control to configure the service worker and thus making it easier
ekzyis added a commit to ekzyis/stacker.news that referenced this issue Jun 20, 2023
next-pwa was last updated in August 2022.
There is also an issue which mentions that next-pwa is abandoned (?): shadowwalker/next-pwa#482

But the main reason for me uninstalling it is that it adds a lot of preconfigured stuff which is not necessary for us.
It even lead to a bug since pages were cached without our knowledge.

So I will go with a different PWA approach. This different approach should do the following:
- make it more transparent what the service worker is doing
- gives us more control to configure the service worker and thus making it easier
ekzyis added a commit to ekzyis/stacker.news that referenced this issue Jun 23, 2023
next-pwa was last updated in August 2022.
There is also an issue which mentions that next-pwa is abandoned (?): shadowwalker/next-pwa#482

But the main reason for me uninstalling it is that it adds a lot of preconfigured stuff which is not necessary for us.
It even lead to a bug since pages were cached without our knowledge.

So I will go with a different PWA approach. This different approach should do the following:
- make it more transparent what the service worker is doing
- gives us more control to configure the service worker and thus making it easier
huumn pushed a commit to stackernews/stacker.news that referenced this issue Jul 4, 2023
* npm uninstall next-pwa

next-pwa was last updated in August 2022.
There is also an issue which mentions that next-pwa is abandoned (?): shadowwalker/next-pwa#482

But the main reason for me uninstalling it is that it adds a lot of preconfigured stuff which is not necessary for us.
It even lead to a bug since pages were cached without our knowledge.

So I will go with a different PWA approach. This different approach should do the following:
- make it more transparent what the service worker is doing
- gives us more control to configure the service worker and thus making it easier

* Use workbox-webpack-plugin

Every other plugin (`next-offline`, `next-workbox-webpack-plugin`, `next-with-workbox`, ...) added unnecessary configuration which felt contrary to how PWAs should be built.
(PWAs should progressivly enhance the website in small steps, see https://web.dev/learn/pwa/getting-started/#focus-on-a-feature)

These default configurations even lead to worse UX since they made invalid assumptions about stacker.news:
We _do not_ want to cache our start url and we _do not_ want to cache anything unless explicitly told to.
Almost every page on SN should be fresh for the best UX.

To achieve this, by default, the service worker falls back to the network (as if the service worker wasn't there).

Therefore, this should be the simplest configuration with a valid precache and cache busting support.

In the future, we can try to use prefetching to improve performance of navigation requests.

* Add support for Web Share Target API

See https://developer.chrome.com/articles/web-share-target/

* Use Web Push API for push notifications

I followed this (very good!) guide: https://web.dev/notifications/

* Refactor code related to Web Push

* Send push notification to users on events

* Merge notifications

* Send notification to author of every parent recursively

* Remove unused userId param in savePushSubscription

As it should be, the user id is retrieved from the authenticated user in the backend.

* Resubscribe user if push subscription changed

* Update old subscription if oldEndpoint was given

* Allow users to unsubscribe

* Use LTREE operator instead of recursive query

* Always show checkbox for push notifications

* Justify checkbox to end

* Update title of first push notification

* Fix warning from uncontrolled to controlled

* Add comment about Notification.requestPermission

* Fix timestamp

* Catch error on push subscription toggle

* Wrap function bodies in try/catch

* Use Promise.allSettled

* Filter subscriptions by user notification settings

* Fix user notification filter

* Use skipWaiting

---------

Co-authored-by: ekzyis <ek@stacker.news>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants