How to fix a sporadic error in app that's using Vue Apollo? #734
Unanswered
matthew-spire
asked this question in
Q&A
Replies: 1 comment
-
In this scenario you are calling some property on something that is undefined. You can use
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Note: I don't think this is necessarily a Vue Apollo error. Also, I have asked for help numerous different places and have gotten no response, so I'm kind of desperate.
I am getting the following error sporadically:
vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in render: "TypeError: Cannot read property 'books' of undefined"
found in
---> at src/views/Home.vue at src/App.vue warn @ vue.runtime.esm.js?2b0e:619 logError @ vue.runtime.esm.js?2b0e:1884 globalHandleError @ vue.runtime.esm.js?2b0e:1879 handleError @ vue.runtime.esm.js?2b0e:1839 Vue._render @ vue.runtime.esm.js?2b0e:3544 updateComponent @ vue.runtime.esm.js?2b0e:4060 get @ vue.runtime.esm.js?2b0e:4473 run @ vue.runtime.esm.js?2b0e:4548 flushSchedulerQueue @ vue.runtime.esm.js?2b0e:4304 (anonymous) @ vue.runtime.esm.js?2b0e:1980 flushCallbacks @ vue.runtime.esm.js?2b0e:1906 Promise.then (async) ...
in an app using Vue Apollo.
The view which contains the error is Home.vue, given below:
So, if you start off with the default (i.e. "All") and you click on "Featured", then it will show the featured books. If, after clicking on "Featured", you then try to click on any of the other categories, the view will not update but the data can be seen in the Vue dev tools. There is no error in the console window.
Refreshing and starting off with the default, then clicking on any of the categories, will filter and show the books in that category. If, however, you click on a category and then try clicking on "Featured", you'll get the error message and a perpetual "Loading..." message.
That's the behavior I got when I tried it multiple ways.
I've tried remove the "Featured" portion, I have tried changing the logic around, all to no avail. The queries don't seem to be the issue.
I also asked this question on Laracasts, but haven't received a response yet, so thought I'd post here.
GitHub links:
Front end: https://github.com/matthew-spire/booksql-vue Back end: https://github.com/matthew-spire/booksql-laravel
I am following the tutorial at https://www.youtube.com/watch?v=636AcqUenhY&list=PLEhEHUEU3x5qsA5JnRzhgOghrH9Vqz4cg&index=3, where he acknowledges that there is an error, but it's never fixed and I don't think he realizes how app breaking it is.
Beta Was this translation helpful? Give feedback.
All reactions