ionic-team / ionic-pwa-toolkit

Build lightning fast Progressive Web Apps with zero config and best practices built-in. Go from zero to production ready with Ionic and Stencil (Web Components).
MIT License
633 stars 74 forks source link

Cannot read property 'pushManager' of undefined #30

Closed Shane-Lester closed 6 years ago

Shane-Lester commented 6 years ago

Resources: Before submitting an issue, please consult our docs.

Stencil version: (run npm list @stencil/core from a terminal/cmd prompt and paste output below):

-- @stencil/core@0.6.1

I'm submitting a ... (check one with "x") [ x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://stencil-worldwide.slack.com

Current behavior:

Error in console after npm start (from the unchanged cloned repo)

app-profile.md.js:45 Uncaught (in promise) TypeError: Cannot read property 'pushManager' of undefined
    at navigator.serviceWorker.getRegistration.then (app-profile.md.js:45)
    at <anonymous>

Expected behavior:

no error

Steps to reproduce:

Clone repo npm install npm start (as per the README) Click on Profile page Toggle Notifications

Related code:

Other information:

Logs true to the console when there is an error (Notifcations toggled on). No error when toggled false

arjunyel commented 6 years ago

In your app-profile.tsx change your handleSub() method to the one from my pull request https://github.com/ionic-team/ionic-pwa-toolkit/pull/29/files#diff-a34eae357d531d9682969d92be8eaef1R43

jgw96 commented 6 years ago

Hey! I just merged that PR, thanks @arjunyel !