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

tree -> expand-on-click -> flatten.js err: TypeError: Cannot read properties of undefined (reading 'forEach') #3089

Closed
gowy222 opened this issue Jun 11, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@gowy222
Copy link

gowy222 commented Jun 11, 2022

TuSimple/naive-ui version (版本)

2.30.3

Vue version (Vue 版本)

3.2.37

Browser and its version (浏览器及其版本)

95内核 100内核 都复现

System and its version (系统及其版本)

win11

Node version (Node 版本)

Reappearance link (重现链接)

https://www.naiveui.com/zh-CN/dark/components/tree#node-props.vue

Reappearance steps (重现步骤)

官网 代码样本 异步加载 block-node expand-on-click

<n-tree
	class=""
	style="white-space: nowrap"
	block-line
	block-node
	selectable
	expand-on-click
	:data="data"
	:on-load="handleLoad"
	:on-update:selected-keys="handleSelectedKeysChange"
/>

点击tree item
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'forEach')
at traverse (flatten.js?646f:5)
at flatten (flatten.js?646f:21)
at eval (Tree.js?9e9b:408)
at callWithErrorHandling (runtime-core.esm-bundler.js?f781:155)
at callWithAsyncErrorHandling (runtime-core.esm-bundler.js?f781:164)
at Array.job (runtime-core.esm-bundler.js?f781:1782)
at flushPreFlushCbs (runtime-core.esm-bundler.js?f781:328)
at flushJobs (runtime-core.esm-bundler.js?f781:371)

Expected results (期望的结果)

点击 label 可以直接 自动展开 或者 收起 节点

Actual results (实际的结果)

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'forEach')

Remarks (补充说明)

@github-actions github-actions bot added the untriaged need to sort label Jun 11, 2022
@gowy222
Copy link
Author

gowy222 commented Jun 11, 2022

估计是 异步 加载数据,flatten -> forEach却已经跑了,没等异步返回数据

@07akioni 07akioni added bug Something isn't working and removed untriaged need to sort labels Jun 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants