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

Taro.switchTab跳转页面,mergePageInstance报错:Invalid attempt to spread non-iterable instance #8565

Closed
xiayuqing opened this issue Jan 21, 2021 · 7 comments
Labels
T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@xiayuqing
Copy link

相关平台

微信小程序

复现仓库

https://github.com/xiayuqing/taro-error-demo.git
小程序基础库: 2.14.4
使用框架: Nerv

复现步骤

1.启动进入首页。(对应用户进入小程序)
2.进入“我的”页面,点击“退出登录”,redirectTo重定向到登录页。
3.点击登录,switchTab进入首页。此时报错从而导致整个页面渲染失败,需要“重新进入小程序”才能恢复正常访问。

需要注意的是:该问题在微信开发者工具中并不会出现,在真机上运行才会出现。使用demo时请替换成你们自己的 appId。

react.ts:47 TypeError: Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
    at _nonIterableSpread (vendors.js:425)
    at _toConsumableArray (vendors.js:631)
    at eval (react.ts:110)
    at Array.forEach (<anonymous>)
    at Object.mergePageInstance (react.ts:106)
    at injectPageInstance (common.ts:22)
    at inject (react.ts:30)
    at eval (vendors.js:1066)
    at errorCatcher (vendors.js:2533)
    at Object.attach (vendors.js:1065)

视频链接

image

期望结果

从switchTab跳转页面能正常渲染。

实际结果

switchTab跳转到目标页面mergePageInstance报错。

环境信息

👽 Taro v3.0.24


  Taro CLI 3.0.24 environment info:
    System:
      OS: macOS 10.15.6
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 10.16.0 - /usr/local/bin/node
      Yarn: 1.7.0 - /usr/local/bin/yarn
      npm: 6.14.5 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 3.0.24 => 3.0.24 
      @tarojs/mini-runner: 3.0.24 => 3.0.24 
      @tarojs/runtime: 3.0.24 => 3.0.24 
      @tarojs/taro: 3.0.24 => 3.0.24 
      @tarojs/webpack-runner: 3.0.24 => 3.0.24 
      babel-preset-taro: 3.0.24 => 3.0.24 
      eslint-config-taro: 3.0.24 => 3.0.24 
      nervjs: ^1.5.7 => 1.5.7 
@taro-bot2 taro-bot2 bot added F-nerv T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Jan 21, 2021
@IOriens
Copy link

IOriens commented Jan 23, 2021

遇到了相同的错误,类似于 issue #8526

@broven
Copy link

broven commented Jan 29, 2021

+1 3.0.24

@chaos-leo
Copy link

+1

@xiayuqing
Copy link
Author

找到了一个解决办法。
在第二步“退出登录”的时候,使用 reLaunch替代redirectTo重定向到登录页,重新登录后不会出现该问题。
微信文档:https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.reLaunch.html

@xiayuqing
Copy link
Author

.

@wlchn
Copy link

wlchn commented May 25, 2021

+1 Taro 版本3.0.18

@Chen-jj
Copy link
Contributor

Chen-jj commented Jun 2, 2021

最新版本已经解决了,可以升级后再试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

6 participants