Skip to content

Translate activity clean#1917

Open
OpenLucasKaka wants to merge 11 commits into
reactjs:mainfrom
OpenLucasKaka:translate-activity-clean
Open

Translate activity clean#1917
OpenLucasKaka wants to merge 11 commits into
reactjs:mainfrom
OpenLucasKaka:translate-activity-clean

Conversation

@OpenLucasKaka
Copy link
Copy Markdown

已经重新从main拉去最新代码 并将review后的更改合并

@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zh-hans-react-dev Ready Ready Preview, Comment May 12, 2026 7:54am

Request Review

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link
Copy Markdown
Collaborator

@loveloki loveloki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果同意建议的话直接应用就行,有不同意见在里面进行评论,记得不要 force push,提交新的 commit 来进行修改

Comment thread src/content/reference/react/Activity.md Outdated
Comment thread src/content/reference/react/Activity.md Outdated
Comment thread src/content/reference/react/Activity.md Outdated
Comment thread src/content/reference/react/Activity.md Outdated
Comment thread src/content/reference/react/Activity.md Outdated
Comment thread src/content/reference/react/Activity.md Outdated
Comment thread src/content/reference/react/Activity.md Outdated
Comment thread src/content/reference/react/Activity.md Outdated
Comment thread src/content/reference/react/Activity.md Outdated
Comment thread src/content/reference/react/Activity.md Outdated
OpenLucasKaka and others added 6 commits May 12, 2026 15:23
Co-authored-by: Xleine <github@xleine.moe>
Co-authored-by: Xleine <github@xleine.moe>
Co-authored-by: Xleine <github@xleine.moe>
Co-authored-by: Xleine <github@xleine.moe>
Co-authored-by: Xleine <github@xleine.moe>
Co-authored-by: Xleine <github@xleine.moe>
@OpenLucasKaka
Copy link
Copy Markdown
Author

已全部修复

### 恢复隐藏组件的 DOM {/*restoring-the-dom-of-hidden-components*/}

Since Activity boundaries hide their children using `display: none`, their children's DOM is also preserved when hidden. This makes them great for maintaining ephemeral state in parts of the UI that the user is likely to interact with again.
由于 `Activity` 边界使用 `display: none` 来隐藏其子组件,因此这些子组件的 DOM 在隐藏时也会被保留。这使得它们非常适合用于维护 UI 中那些用户可能会再次交互的部分的 ephemeral state
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可能是我没有表达清楚,这里 ephemeral state 可以翻译成中文,但是第一次翻译需要带上原文。例如:瞬时状态(ephemeral state),之前的问题是在第二次中文翻译的地方添加的英文原文。

不是说要恢复成英文,把这个再调整一下吧

```

When an Activity boundary is <CodeStep step={1}>hidden</CodeStep> during its initial render, its children won't be visible on the page — but they will _still be rendered_, albeit at a lower priority than the visible content, and without mounting their Effects.
当 `Activity` 边界在初次渲染时处于 <CodeStep step={1}>隐藏</CodeStep> 状态,其子组件虽然不会在页面上显示,但它们**仍会被渲染**。不过,它们的渲染优先级会低于可见内容,且不会挂载它们的 Effect。
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`Activity` 边界在初次渲染时处于 <CodeStep step={1}>隐藏</CodeStep> 状态,其子组件虽然不会在页面上显示,但它们**仍会被渲染**。不过,它们的渲染优先级会低于可见内容,且不会挂载它们的 Effect。
`Activity` 边界在初次渲染时处于 <CodeStep step={1}>隐藏</CodeStep> 状态,其子组件虽然不会在页面上显示,但它们 **仍会被渲染**。不过,它们的渲染优先级会低于可见内容,且不会挂载它们的 Effect。

`Activity` 边界通过在其子组件上设置 `display: none` 并清理它们所有的 Effect 来隐藏内容。因此,大多数遵循最佳实践、能够正确清理自身副作用的 React 组件,在被 `Activity` 隐藏时都具有足够的健壮性。

But there _are_ some situations where a hidden component behaves differently than an unmounted one. Most notably, since a hidden component's DOM is not destroyed, any side effects from that DOM will persist, even after the component is hidden.
但是,也**确实存在**一些情况下,隐藏组件的表现与卸载组件确实有所不同。最显著的一点是:由于隐藏组件的 DOM 并没有被销毁,来自该 DOM 的任何副作用都将持续存在,即便在组件被隐藏之后也是如此。
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
但是,也**确实存在**一些情况下,隐藏组件的表现与卸载组件确实有所不同。最显著的一点是:由于隐藏组件的 DOM 并没有被销毁,来自该 DOM 的任何副作用都将持续存在,即便在组件被隐藏之后也是如此。
但是,也 **确实存在** 一些情况下,隐藏组件的表现与卸载组件确实有所不同。最显著的一点是:由于隐藏组件的 DOM 并没有被销毁,来自该 DOM 的任何副作用都将持续存在,即便在组件被隐藏之后也是如此。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants