Skip to content

Commit a0c3121

Browse files
merging all conflicts
2 parents bcf760e + e85b71d commit a0c3121

12 files changed

+71
-22
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"next-remote-watch": "^1.0.0",
3737
"parse-numeric-range": "^1.2.0",
3838
"react": "^0.0.0-experimental-16d053d59-20230506",
39-
"react-collapsed": "npm:@gaearon/[email protected]",
39+
"react-collapsed": "4.0.4",
4040
"react-dom": "^0.0.0-experimental-16d053d59-20230506",
4141
"remark-frontmatter": "^4.0.1",
4242
"remark-gfm": "^3.0.1"

src/components/Layout/Sidebar/SidebarRouteTree.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {useRef, useLayoutEffect, Fragment} from 'react';
77
import cn from 'classnames';
88
import {useRouter} from 'next/router';
99
import {SidebarLink} from './SidebarLink';
10-
import useCollapse from 'react-collapsed';
10+
import {useCollapse} from 'react-collapsed';
1111
import usePendingRoute from 'hooks/usePendingRoute';
1212
import type {RouteItem} from 'components/Layout/getRouteMeta';
1313

src/components/Seo.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ const deployedTranslations = [
2222
'zh-hans',
2323
'es',
2424
'fr',
25+
<<<<<<< HEAD
26+
=======
27+
'ja',
28+
>>>>>>> e85b71de88a20cda9588f51f01d4a70e5cbe1cb4
2529
// We'll add more languages when they have enough content.
2630
// Please DO NOT edit this list without a discussion in the reactjs/react.dev repo.
2731
// It must be the same between all translations.

src/content/learn/rendering-lists.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,11 @@ export const recipes = [{
10861086

10871087
#### 帶有分隔線的列表 {/*list-with-a-separator*/}
10881088

1089+
<<<<<<< HEAD
10891090
這個範例展示了葛飾北斎一首著名的俳句,它的每一行都由 `<p>` 標籤包覆。你需要在段落之間插入一個 `<hr />` 分隔線。你的結果大概會像這個樣子:
1091+
=======
1092+
This example renders a famous haiku by Tachibana Hokushi, with each line wrapped in a `<p>` tag. Your job is to insert an `<hr />` separator between each paragraph. Your resulting structure should look like this:
1093+
>>>>>>> e85b71de88a20cda9588f51f01d4a70e5cbe1cb4
10901094
10911095
```js
10921096
<article>

src/content/learn/start-a-new-react-project.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ npx create-next-app@latest
2626

2727
如果你是第一次使用 Next.js,請參考 [Next.js 教學](https://nextjs.org/learn/foundations/about-nextjs)
2828

29+
<<<<<<< HEAD
2930
Next.js 是由 [Vercel](https://vercel.com/) 維護。你可以將 [Next.js 應用程式部署](https://nextjs.org/docs/app/building-your-application/deploying)到任何 Node.js 或 serverless 主機,或是你自己的伺服器上。Next.js 也支援 [static export](https://nextjs.org/docs/pages/building-your-application/deploying/static-exports),它不需要伺服器。
31+
=======
32+
Next.js is maintained by [Vercel](https://vercel.com/). You can [deploy a Next.js app](https://nextjs.org/docs/app/building-your-application/deploying) to any Node.js or serverless hosting, or to your own server. Next.js also supports a [static export](https://nextjs.org/docs/pages/building-your-application/deploying/static-exports) which doesn't require a server.
33+
>>>>>>> e85b71de88a20cda9588f51f01d4a70e5cbe1cb4
3034
3135
### Remix {/*remix*/}
3236

@@ -89,9 +93,15 @@ Expo 由 [Expo(公司)](https://expo.dev/about)維護。使用 Expo 構建
8993

9094
### Next.js (App Router) {/*nextjs-app-router*/}
9195

96+
<<<<<<< HEAD
9297
**[Next.js 的 App Router](https://nextjs.org/docs) 是 Next.js API 的重新設計,旨在實現 React 團隊的全端架構願景。**它允許你在執行於伺服器上或甚至是構建期間的非同步(asynchronous) component 中取得資料。
9398

9499
Next.js 是由 [Vercel](https://vercel.com/) 維護。你可以將 [Next.js 應用程式部署](https://nextjs.org/docs/app/building-your-application/deploying)到任何 Node.js 或 serverless 主機,或是你自己的伺服器上。Next.js 還支援[靜態匯出](https://nextjs.org/docs/app/building-your-application/deploying/static-exports),不需要伺服器即可執行。
100+
=======
101+
**[Next.js's App Router](https://nextjs.org/docs) is a redesign of the Next.js APIs aiming to fulfill the React team’s full-stack architecture vision.** It lets you fetch data in asynchronous components that run on the server or even during the build.
102+
103+
Next.js is maintained by [Vercel](https://vercel.com/). You can [deploy a Next.js app](https://nextjs.org/docs/app/building-your-application/deploying) to any Node.js or serverless hosting, or to your own server. Next.js also supports [static export](https://nextjs.org/docs/app/building-your-application/deploying/static-exports) which doesn't require a server.
104+
>>>>>>> e85b71de88a20cda9588f51f01d4a70e5cbe1cb4
95105
96106
<DeepDive>
97107

src/content/learn/state-as-a-snapshot.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,15 @@ label, textarea { margin-bottom: 10px; display: block; }
7777

7878
當 React 重新 render component 時:
7979

80+
<<<<<<< HEAD
8081
1. React 再次呼叫函式。
8182
2. 你的函式回傳一個全新的 JSX 快照。
8283
3. React 接著更新畫面,使畫面與你回傳的快照相符。
84+
=======
85+
1. React calls your function again.
86+
2. Your function returns a new JSX snapshot.
87+
3. React then updates the screen to match the snapshot your function returned.
88+
>>>>>>> e85b71de88a20cda9588f51f01d4a70e5cbe1cb4
8389
8490
<IllustrationBlock sequential>
8591
<Illustration caption="React executing the function" src="/images/docs/illustrations/i_render1.png" />

src/content/learn/typescript.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ export default App = AppTSX;
284284

285285
</Sandpack>
286286

287-
This technique works when you have an default value which makes sense - but there are occasionally cases when you do not, and in those cases `null` can feel reasonable as a default value. However, to allow the type-system to understand your code, you need to explicitly set `ContextShape | null` on the `createContext`.
287+
This technique works when you have a default value which makes sense - but there are occasionally cases when you do not, and in those cases `null` can feel reasonable as a default value. However, to allow the type-system to understand your code, you need to explicitly set `ContextShape | null` on the `createContext`.
288288

289289
This causes the issue that you need to eliminate the `| null` in the type for context consumers. Our recommendation is to have the hook do a runtime check for it's existence and throw an error when not present:
290290

@@ -460,4 +460,4 @@ We recommend the following resources:
460460

461461
- [React TypeScript Cheatsheet](https://react-typescript-cheatsheet.netlify.app/) is a community-maintained cheatsheet for using TypeScript with React, covering a lot of useful edge cases and providing more breadth than this document.
462462

463-
- [TypeScript Community Discord](https://discord.com/invite/typescript) is a great place to ask questions and get help with TypeScript and React issues.
463+
- [TypeScript Community Discord](https://discord.com/invite/typescript) is a great place to ask questions and get help with TypeScript and React issues.

src/content/reference/react/experimental_taintObjectReference.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ experimental_taintObjectReference(
6868

6969
<Pitfall>
7070

71+
<<<<<<< HEAD
7172
**Do not rely on just tainting for security.** Tainting an object doesn't prevent leaking of every possible derived value. For example, the clone of a tainted object will create a new untained object. Using data from a tainted object (e.g. `{secret: taintedObj.secret}`) will create a new value or object that is not tainted. Tainting is a layer of protection, a secure app will have multiple layers of protection, well designed APIs, and isolation patterns.
73+
=======
74+
**Do not rely on just tainting for security.** Tainting an object doesn't prevent leaking of every possible derived value. For example, the clone of a tainted object will create a new untained object. Using data from a tainted object (e.g. `{secret: taintedObj.secret}`) will create a new value or object that is not tainted. Tainting is a layer of protection; a secure app will have multiple layers of protection, well designed APIs, and isolation patterns.
75+
>>>>>>> e85b71de88a20cda9588f51f01d4a70e5cbe1cb4
7276
7377
</Pitfall>
7478

src/content/reference/react/experimental_taintUniqueValue.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ In this example, the constant `password` is tainted. Then `password` is used to
130130

131131
Other similar ways of deriving new values from tainted values like concatenating it into a larger string, converting it to base64, or returning a substring create untained values.
132132

133+
<<<<<<< HEAD
133134
Tainting only protects against simple mistakes like explictly passing secret values to the client. Mistakes in calling the `taintUniqueValue` like using a global store outside of React, without the corresponding lifetime object, can cause the tainted value to become untainted. Tainting is a layer of protection, a secure app will have multiple layers of protection, well designed APIs, and isolation patterns.
135+
=======
136+
Tainting only protects against simple mistakes like explictly passing secret values to the client. Mistakes in calling the `taintUniqueValue` like using a global store outside of React, without the corresponding lifetime object, can cause the tainted value to become untainted. Tainting is a layer of protection; a secure app will have multiple layers of protection, well designed APIs, and isolation patterns.
137+
>>>>>>> e85b71de88a20cda9588f51f01d4a70e5cbe1cb4
134138
135139
</Pitfall>
136140

src/content/reference/react/useSyncExternalStore.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,26 @@ The current snapshot of the store which you can use in your rendering logic.
5757
5858
* If a different `subscribe` function is passed during a re-render, React will re-subscribe to the store using the newly passed `subscribe` function. You can prevent this by declaring `subscribe` outside the component.
5959
60+
* If the store is mutated during a [non-blocking transition update](/reference/react/useTransition), React will fall back to performing that update as blocking. Specifically, React will call `getSnapshot` a second time just before applying changes to the DOM. If it returns a different value than when it was called originally, React will restart the transition update from scratch, this time applying it as a blocking update, to ensure that every component on screen is reflecting the same version of the store.
61+
62+
* It's not recommended to _suspend_ a render based on a store value returned by `useSyncExternalStore`. The reason is that mutations to the external store cannot be [marked as non-blocking transition updates](/reference/react/useTransition), so they will trigger the nearest [`Suspense` fallback](/reference/react/Suspense), replacing already-rendered content on screen with a loading spinner, which typically makes a poor UX.
63+
64+
For example, the following are discouraged:
65+
66+
```js
67+
const LazyProductDetailPage = lazy(() => import('./ProductDetailPage.js'));
68+
69+
function ShoppingApp() {
70+
const selectedProductId = useSyncExternalStore(...);
71+
72+
// ❌ Calling `use` with a Promise dependent on `selectedProductId`
73+
const data = use(fetchItem(selectedProductId))
74+
75+
// ❌ Conditionally rendering a lazy component based on `selectedProductId`
76+
return selectedProductId != null ? <LazyProductDetailPage /> : <FeaturedProducts />;
77+
}
78+
```
79+
6080
---
6181
6282
## Usage {/*usage*/}
@@ -425,4 +445,4 @@ function ChatIndicator({ userId }) {
425445

426446
// ...
427447
}
428-
```
448+
```

src/sidebarReference.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,21 @@
130130
},
131131
{
132132
"title": "experimental_taintObjectReference",
133+
<<<<<<< HEAD
133134
"path": "/reference/react/experimental_taintObjectReference"
134135
},
135136
{
136137
"title": "experimental_taintUniqueValue",
137138
"path": "/reference/react/experimental_taintUniqueValue"
139+
=======
140+
"path": "/reference/react/experimental_taintObjectReference",
141+
"canary": true
142+
},
143+
{
144+
"title": "experimental_taintUniqueValue",
145+
"path": "/reference/react/experimental_taintUniqueValue",
146+
"canary": true
147+
>>>>>>> e85b71de88a20cda9588f51f01d4a70e5cbe1cb4
138148
}
139149
]
140150
},

yarn.lock

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4797,11 +4797,6 @@ path-type@^4.0.0:
47974797
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
47984798
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==
47994799

4800-
performance-now@^2.1.0:
4801-
version "2.1.0"
4802-
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
4803-
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
4804-
48054800
periscopic@^3.0.0:
48064801
version "3.0.4"
48074802
resolved "https://registry.yarnpkg.com/periscopic/-/periscopic-3.0.4.tgz#b3fbed0d1bc844976b977173ca2cd4a0ef4fa8d1"
@@ -5284,13 +5279,6 @@ queue-microtask@^1.2.2:
52845279
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
52855280
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==
52865281

5287-
raf@^3.4.1:
5288-
version "3.4.1"
5289-
resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39"
5290-
integrity sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==
5291-
dependencies:
5292-
performance-now "^2.1.0"
5293-
52945282
range-parser@~1.2.1:
52955283
version "1.2.1"
52965284
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031"
@@ -5306,12 +5294,11 @@ [email protected]:
53065294
iconv-lite "0.4.24"
53075295
unpipe "1.0.0"
53085296

5309-
"react-collapsed@npm:@gaearon/[email protected]":
5310-
version "3.1.0-forked.1"
5311-
resolved "https://registry.yarnpkg.com/@gaearon/react-collapsed/-/react-collapsed-3.1.0-forked.1.tgz#b287b81fc2af2971d7d7b523dc40b6cf116822ac"
5312-
integrity sha512-QkW55Upl4eeOtnDMOxasafDtDwaF+DpYKvHq8KZoNz9P477iUH8Ik1YFYuqtI7UA8mHm1/z66LD678dZCXwEEg==
5297+
react-collapsed@4.0.4:
5298+
version "4.0.4"
5299+
resolved "https://registry.yarnpkg.com/react-collapsed/-/react-collapsed-4.0.4.tgz#4c6bce3a15286d43e95b6730ad70ec387a54caa9"
5300+
integrity sha512-8avvmnQxDYTgGZYVP9+3Z7doomxVEBoCkukpTmUHEIrAYvELZ5jNNfYCt/hCpHB6GmQbzZoDmnDupjsnQVgcCQ==
53135301
dependencies:
5314-
raf "^3.4.1"
53155302
tiny-warning "^1.0.3"
53165303

53175304

0 commit comments

Comments
 (0)