alibaba / alibaba/ice

ice3嵌套路由切换时前一个页面卸载时依旧会render的bug

Open
#6,955 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
18.6k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

嵌套路由时,如/page/a -> /page/b切换时,会先执行a的render,再执行b的render。

Expected behavior

嵌套路由时,期望/page/a -> /page/b时,只执行b的render,a不应该执行。

Actual behavior

图1:初始加载/todo/t1路由
image
图2:点击图1中的to t2的按钮,调用history.push('/todo/t2'),执行了t1 run,卸载了t1不应该再执行t1了。这里有问题
image
图3:文件目录
image
图4:t1和t2两个嵌套路由的组件代码
image

Version of ice.js

ice3

Content of build.json or ice.config.mts

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the nested-route transition from /todo/t1 to /todo/t2 using history.push('/todo/t2'), then inspect the t1 and t2 component render and unload behavior shown in the issue. The work is done when switching routes renders only t2 and no longer runs t1's render after it is unloaded.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.