VueJS and Axios causing 'error during execution of scheduler flush' and Uncaught (in promise) TypeError

huangapple go评论65阅读模式
英文:

VueJS and Axios causing 'error during execution of scheduler flush' and Uncaught (in promise) TypeError

问题

所以我已经检查了我的代码一段时间,发现这个错误是由这行代码引起的:

treeNodes.value = documentStore.convertToTree((await axios.get('/File')).data);

首先,我收到了以下警告:

Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core

然后,我收到了这个错误:

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'parentNode')

尝试阅读了一些旧帖子,但没有找到有用的信息。

有什么想法吗?谢谢。

英文:

So i have been poking my code for a while and found out that this error is caused specifically by this line of code:

treeNodes.value = documentStore.convertToTree((await axios.get('/File')).data);

First i get warning saying:

Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core 

and then i get this error:

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'parentNode')

Tried read some older threads but found nothing helpful.

Any ideas?
thanks

答案1

得分: 0

所以我弄清楚了。
问题是我试图在组件挂载之前初始化 treeNodes。
所以我只是在 onMounted 中初始化它,它正常工作。

英文:

So i figured it out.
The problem was that i tried to initialize treeNodes before component was mounted.
So i just init it in onMounted and it works fine.

huangapple
  • 本文由 发表于 2023年5月29日 20:00:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/76357176.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定