Skip to content

Commit 44d0c6c

Browse files
merging all conflicts
2 parents 1346190 + a5aad0d commit 44d0c6c

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed

.github/workflows/discord_notify.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ name: Discord Notify
22

33
on:
44
pull_request_target:
5-
types: [ labeled ]
5+
types: [labeled]
66

77
jobs:
8+
check_maintainer:
9+
uses: facebook/react/.github/workflows/shared_check_maintainer.yml@main
10+
with:
11+
actor: ${{ github.event.pull_request.user.login }}
12+
is_remote: true
13+
814
notify:
9-
if: ${{ github.event.label.name == 'React Core Team' }}
15+
if: ${{ needs.check_maintainer.outputs.is_core_team == 'true' }}
16+
needs: check_maintainer
1017
runs-on: ubuntu-latest
1118
steps:
1219
- name: Discord Webhook Action
@@ -18,4 +25,4 @@ jobs:
1825
embed-author-icon-url: ${{ github.event.pull_request.user.avatar_url }}
1926
embed-title: '#${{ github.event.number }} (+${{github.event.pull_request.additions}} -${{github.event.pull_request.deletions}}): ${{ github.event.pull_request.title }}'
2027
embed-description: ${{ github.event.pull_request.body }}
21-
embed-url: ${{ github.event.pull_request.html_url }}
28+
embed-url: ${{ github.event.pull_request.html_url }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Label Core Team PRs
2+
3+
on:
4+
pull_request_target:
5+
6+
env:
7+
TZ: /usr/share/zoneinfo/America/Los_Angeles
8+
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout
9+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
10+
11+
jobs:
12+
check_maintainer:
13+
uses: facebook/react/.github/workflows/shared_check_maintainer.yml@main
14+
with:
15+
actor: ${{ github.event.pull_request.user.login }}
16+
is_remote: true
17+
18+
label:
19+
if: ${{ needs.check_maintainer.outputs.is_core_team == 'true' }}
20+
runs-on: ubuntu-latest
21+
needs: check_maintainer
22+
steps:
23+
- name: Label PR as React Core Team
24+
uses: actions/github-script@v7
25+
with:
26+
script: |
27+
github.rest.issues.addLabels({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
issue_number: ${{ github.event.number }},
31+
labels: ['React Core Team']
32+
});

src/content/reference/react/useActionState.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,15 @@ form state 是一个只在表单被提交触发 action 后才会被更新的值
6767
6868
`useActionState` 返回一个包含以下值的数组:
6969
70+
<<<<<<< HEAD
7071
1. 当前的 state。第一次渲染期间,该值为传入的 `initialState` 参数值。在 action 被调用后该值会变为 action 的返回值。
7172
2. 一个新的 action 函数用于在你的 `form` 组件的 `action` 参数或表单中任意一个 `button` 组件的 `formAction` 参数中传递。
7273
3. 一个 `isPending` 标识,用于表明是否有正在 pending 的 Transition。
74+
=======
75+
1. The current state. During the first render, it will match the `initialState` you have passed. After the action is invoked, it will match the value returned by the action.
76+
2. A new action that you can pass as the `action` prop to your `form` component or `formAction` prop to any `button` component within the form. The action can also be called manually within [`startTransition`](/reference/react/startTransition).
77+
3. The `isPending` flag that tells you whether there is a pending Transition.
78+
>>>>>>> a5aad0d5e92872ef715b462b1dd6dcbeb45cf781
7379
7480
#### 注意 {/*caveats*/}
7581
@@ -101,9 +107,15 @@ function MyComponent() {
101107
102108
`useActionState` 返回一个包含以下值的数组:
103109
110+
<<<<<<< HEAD
104111
1. 该表单的 <CodeStep step={1}>当前 state</CodeStep>,初始值为提供的 <CodeStep step={4}>初始 state</CodeStep>,当表单被提交后则改为传入的 <CodeStep step={3}>action</CodeStep> 的返回值。
105112
2. 传入 `<form>` 标签的 `action` 属性的 <CodeStep step={2}>新 action</CodeStep>。
106113
3. 一个 <CodeStep step={1}>pending state</CodeStep>,可以在处理 action 的过程中使用它。
114+
=======
115+
1. The <CodeStep step={1}>current state</CodeStep> of the form, which is initially set to the <CodeStep step={4}>initial state</CodeStep> you provided, and after the form is submitted is set to the return value of the <CodeStep step={3}>action</CodeStep> you provided.
116+
2. A <CodeStep step={2}>new action</CodeStep> that you pass to `<form>` as its `action` prop or call manually within `startTransition`.
117+
3. A <CodeStep step={1}>pending state</CodeStep> that you can utilise while your action is processing.
118+
>>>>>>> a5aad0d5e92872ef715b462b1dd6dcbeb45cf781
107119
108120
表单被提交后,传入的 <CodeStep step={3}>action</CodeStep> 函数会被执行。返回值将会作为该表单的新的 <CodeStep step={1}>当前 state</CodeStep>。
109121

0 commit comments

Comments
 (0)