OneSignal / react-onesignal

React OneSignal Module: Make it easy to integrate OneSignal with your React App!
Other
73 stars 26 forks source link

[Question]: Integrating OneSignal ServiceWorker with existing React Service Worker #131

Closed risingwolf21 closed 8 months ago

risingwolf21 commented 10 months ago

How can we help?

I have an existing Service Worker that was built with the create-react-app workbox. Now I want to add the OneSignal Service Worker and recieve Push Notifications in my React Progressive Web App.

When I start my Application it just reloads all the time, trying to install the OneSignal ServiceWorker and refreshes before it installed.

How do I merge my servie workers? Or what are the steps to add OneSignal to an existing React PWA

betocode commented 9 months ago

Having the same issue, dont know how to merge oneSignal service worker with my current service worker...

By following the instructions in the readme, my apps keeps switching on a loop between my pwa service worker and onesignal service worker.

Does anybody know how to solve this?

jkasten2 commented 8 months ago

@risingwolf21 @betocode you will need to customize the OneSignal service worker scope to resolve the conflict you are seeing. See the OneSignal documentation on Picking a OneSignal Service Worker Scope to resolve this issue.