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

fix(pwa-utils): handle non-strings in startCase #150

Merged
merged 1 commit into from
Feb 23, 2019
Merged

fix(pwa-utils): handle non-strings in startCase #150

merged 1 commit into from
Feb 23, 2019

Conversation

alexkcollier
Copy link
Contributor

adding a route to workbox.runtimeCaching results in

✖ Nuxt Fatal Error                                 
│                                                      
│   TypeError: Cannot read property '0' of undefined 

if its handler is undefined

@codecov
Copy link

codecov bot commented Feb 22, 2019

Codecov Report

Merging #150 into dev will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@         Coverage Diff         @@
##            dev   #150   +/-   ##
===================================
  Coverage   100%   100%           
===================================
  Files         1      1           
  Lines         2      2           
===================================
  Hits          2      2

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee47410...7fcccfd. Read the comment docs.

@manniL manniL requested a review from pi0 February 23, 2019 10:12
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. But what's the use case of passing undefined as a handler? Would you please add an example to the fixture if there is?

@pi0 pi0 merged commit 782217a into nuxt-community:dev Feb 23, 2019
@manniL
Copy link
Member

manniL commented Feb 23, 2019

@pi0 discovered the same issue rn 🙈 Not specifying a handler should/will default to "networkFirst"

(at least that is what the documentation says: https://pwa.nuxtjs.org/modules/workbox.html#examples)

@alexkcollier
Copy link
Contributor Author

@pi0 in the line below, undefined always gets passed to startCase() if a handler is omitted (i.e.: { urlPattern: 'someurl' }), which throws an error with the way the function was written

handler: startCase(entry.handler) || 'NetworkFirst',

Changing the line to handler: entry.handler ? startCase(entry.handler) : 'NetworkFirst' would solve this as well.

@pi0
Copy link
Member

pi0 commented Feb 23, 2019

Thanks @manniL @alexkcollier

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

Successfully merging this pull request may close these issues.

3 participants