From aa0c547cd6b2cc63b53ba3fc57ec009af1353ecb Mon Sep 17 00:00:00 2001
From: Aki Matsumoto <45055030+nonoakij@users.noreply.github.com>
Date: Wed, 22 Nov 2023 08:27:35 +0900
Subject: [PATCH 1/2] Fix: incorrect sample code in documentation related to
Server action (#6445)
* Fix: component not returned
* Fix: missing function statement
---
.../reference/react-dom/hooks/useFormStatus.md | 2 +-
src/content/reference/react/use-server.md | 12 +++++++-----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/content/reference/react-dom/hooks/useFormStatus.md b/src/content/reference/react-dom/hooks/useFormStatus.md
index 67a06022b..02e48973e 100644
--- a/src/content/reference/react-dom/hooks/useFormStatus.md
+++ b/src/content/reference/react-dom/hooks/useFormStatus.md
@@ -38,7 +38,7 @@ function Submit() {
return
}
-export default App() {
+export default function App() {
return (
+export default function App() {
+ return (
+
+ );
}
```
From 6570e6cd79a16ac3b1a2902632eddab7e6abb9ad Mon Sep 17 00:00:00 2001
From: Sophie Alpert
Date: Thu, 23 Nov 2023 01:44:47 -0800
Subject: [PATCH 2/2] Update useSyncExternalStore.md
---
src/content/reference/react/useSyncExternalStore.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/content/reference/react/useSyncExternalStore.md b/src/content/reference/react/useSyncExternalStore.md
index cda2ec3fa..c557eb90e 100644
--- a/src/content/reference/react/useSyncExternalStore.md
+++ b/src/content/reference/react/useSyncExternalStore.md
@@ -57,7 +57,7 @@ The current snapshot of the store which you can use in your rendering logic.
* 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.
-* 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.
+* 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, for every transition update, 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 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.
* 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.