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

non-array objects must have a [Symbol.iterator]() method #6285

Closed
0x1af2aec8f957 opened this issue Aug 5, 2023 · 3 comments
Closed

non-array objects must have a [Symbol.iterator]() method #6285

0x1af2aec8f957 opened this issue Aug 5, 2023 · 3 comments
Labels

Comments

@0x1af2aec8f957
Copy link

0x1af2aec8f957 commented Aug 5, 2023

Version of antd-mobile

5.32.0

Operating system and its version

Android

Browser and its version

Anddroid 8.1.0 Webview

Sandbox to reproduce

No response

What happened?

在OPPO或者vivo或者一加手机上,Android版本为8.1.0的webview上属于必现。

这是一个很奇怪的问题,在其它比它更低的版本的系统或浏览器中也无法重现,但在 Android版本为8.1.0的webview 上会必现,在Android studio创建的相同系统版本模拟器中也能重现该问题。

错误日志:

  react-dom.production.min.js:189 TypeError: Invalid attempt to destructure non-iterable instance.
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
      at r (_non_iterable_rest.js:2)
      at u (_sliced_to_array.js:7)
      at eL (react-spring-core.esm.js:1986)
      at spin-loading.js:22
      at iT (react-dom.production.min.js:167)
      at aP (react-dom.production.min.js:197)
      at aS (react-dom.production.min.js:195)
      at a_ (react-dom.production.min.js:194)
      at s (react-dom.production.min.js:297)
      at uQ (react-dom.production.min.js:280)

IMAGE 2023-08-05 18:55:49

Relevant log output

经过漫长的排查,最终确定问题发生在使用`@react-spring/web`上面,看起来官方是用它在处理动画的过渡。只要引用使用该hooks的组件就会导致界面白屏(目前我看到的有:modal、spin等),然后控制台抛出异常。

有意思的点是,唯独这个安卓版本有该问题。
@miracles1919
Copy link
Contributor

看着像兼容性问题,试试把 node_modules 里的包也用 babel 编译下, 参考文档兼容性

@0x1af2aec8f957
Copy link
Author

这个问题困扰我很久了,应该不是 node_modules 编译的原因,我使用的是 Parcel2 构建项目,该工具默认就会编译依赖目录。

相关的实现在:parcel-bundler/parcel#7399

复现这个问题很简单,将Babel或者.browserslistrc中的约束限制到:IE11 或者 Chrome 44,就会复现。

@0x1af2aec8f957
Copy link
Author

@miracles1919 看起来这不是库本身的问题,应该是编译工具的问题。我将关闭这个问题,该问题后续跟进在 parcel-issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants