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

navigateTo:fail:not supported #12560

Closed
ZhuQinPeng opened this issue Sep 23, 2022 · 8 comments
Closed

navigateTo:fail:not supported #12560

ZhuQinPeng opened this issue Sep 23, 2022 · 8 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@ZhuQinPeng
Copy link

相关平台

微信小程序

复现仓库

https://gitee.com/zhuqinpeng/my-app.git
小程序基础库: 2.26.0
使用框架: React

复现步骤

运行小程序;
小程序真机调试,重复点击重新进入小程序;

期望结果

不报错,正常进入页面

实际结果

报错,不会跳转页面

环境信息

👽 Taro v3.5.6


  Taro CLI 3.5.6 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 16.12.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
      npm: 8.1.0 - C:\Program Files\nodejs\npm.CMD

补充信息

Unhandled promise rejection {errMsg: "navigateTo:fail:not supported"}

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Sep 23, 2022
@TheKonka
Copy link
Member

试了下,没有复现

@ZhuQinPeng
Copy link
Author

谢谢,上午的时候是可以复现的,现在我自己试不知为啥也不复现,就是点重新进入小程序会一直卡在home页,不会路由到index页,您看能再试一下吗

@ZhuQinPeng
Copy link
Author

image
刚提交了,再试试

@TheKonka
Copy link
Member

image 刚提交了,再试试

image
这个报错是正常的,因为你执行Taro.hideTabBar() 是在onReady 里面,onReady执行时机在componentDidShow之后,所以执行Taro.hideTabBar() 的时候,页面已经导航到 pages/index/indexpages/home/index这个tab页面已经被隐藏了,就报图里面那个错误了,知道问题原因了解决方案也很简单,就是把Taro.hideTabBar()放在componentDidShow里面

@ZhuQinPeng
Copy link
Author

ZhuQinPeng commented Sep 24, 2022

谢谢解答。
我又遇到一个新问题,就是我使用了redux-persist做持久化缓存,在App.tsx中使用如下
image
真机调试会报找不到页面实例,如下:
image
然后我找到了原因,是因为PersistGate组件引起的,不移动这个组件的话,这个问题怎么解决,谢谢

@TheKonka
Copy link
Member

谢谢解答。 我又遇到一个新问题,就是我使用了redux-persist做持久化缓存,在App.tsx中使用如下 image 真机调试会报找不到页面实例,如下: image 然后我找到了原因,是因为PersistGate组件引起的,不移动这个组件的话,这个问题怎么解决,谢谢

这个我不清楚,我只能猜测原因是 PersistGate里面会条件渲染props.children,导致小程序报错
#12432 (comment)

@ZhuQinPeng
Copy link
Author

好的,谢谢

@geekact
Copy link

geekact commented Nov 11, 2022

谢谢解答。 我又遇到一个新问题,就是我使用了redux-persist做持久化缓存,在App.tsx中使用如下 image 真机调试会报找不到页面实例,如下: image 然后我找到了原因,是因为PersistGate组件引起的,不移动这个组件的话,这个问题怎么解决,谢谢

去探索taro源码后发现,在taro不想修改的情况下,需要hack才能彻底解决persist顺序问题,参考:#6548 (comment)

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

No branches or pull requests

3 participants