Closed sunpm closed 3 months ago
In the src/useRouter/index.ts
file, the navigateTo
function has been enhanced to improve navigation logic. Now, before using the navigateTo
method, it checks if the number of pages opened exceeds or equals 10 and opts for redirectTo
in such cases to better manage page navigation stack limits.
File | Change Summary |
---|---|
src/useRouter/index.ts |
Enhanced the navigateTo function to check the number of pages opened and use redirectTo if necessary. |
sequenceDiagram
participant Caller as Caller
participant useRouter as useRouter
participant navigateTo as navigateTo
participant redirectTo as redirectTo
Caller->>useRouter: call navigateTo(options)
useRouter->>navigateTo: check page stack size
navigateTo-->>useRouter: result of page stack size check
alt page stack size >= 10
useRouter->>redirectTo: call redirectTo(options)
redirectTo-->>useRouter: redirection complete
else
useRouter->>navigateTo: proceed with navigateTo(options)
navigateTo-->>useRouter: navigation complete
end
useRouter-->>Caller: navigation result
Amidst the paths of code we tread, A new logic in
navigateTo
is spread, Ten pages open, redirect we must, In our stack, we place our trust. 🐰✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
超过10个就直接变redirect有点不太好。例如刚好第11个页面会莫名没有历史记录。
请问现在是导致路由堆栈溢出导致出错了吗?请告知具体报错。
最理想的解决方案是设定最大历史数量,超过部分删除。
超过10个就直接变redirect有点不太好。例如刚好第11个页面会莫名没有历史记录。
请问现在是导致路由堆栈溢出导致出错了吗?请告知具体报错。
最理想的解决方案是设定最大历史数量,超过部分删除。
小程序路由堆栈最大上限是10个,超过上限会导致路由api跳转失败
已修复一处暗坑。
由 navigatorTo 突然变为 redirectTo 改变了用户的使用意图。
至于小程序的限制,这个交由用户去掌控吧
Description 描述
当超过10个页面时,用 uni.redirectTo API 替换 uni.navigatorTo
Linked Issues 关联的 Issues
Additional context 额外上下文
Summary by CodeRabbit