EvanAgee / vuejs-wordpress-theme-starter

A WordPress theme with the guts ripped out and replaced with Vue.
https://vuewp.com/
1.6k stars 281 forks source link

state.all.filter is not a function #37

Closed Charles-antoine closed 5 years ago

Charles-antoine commented 5 years ago

Hi, I'm trying to use your theme starter but i'm confronted to this error:

davidmartindev commented 5 years ago

I'm seeing this also. Did you get a chance to investigate?

EvanAgee commented 5 years ago

Hey, sorry you're having issues. From what I can tell this could be happening because the list of pages hasn't yet been pulled from the WP API. I'm not sure when I'll have a chance to check it out but I'll have a look.

davidmartindev commented 5 years ago

Thanks, @EvanAgee. I'll be doing the same also, will update with my findings.

rugor commented 5 years ago

The array may be empty when filter is attempted. Try first checking array length with an if statement, something like:

if (state.all.length) return state.all.find(page => page.id === id)