Skip to content

Conversation

react-translations-bot
Copy link
Collaborator

sophiebits and others added 30 commits December 2, 2024 14:13
* React v19 blog update

* re-add sebbie's install updates

Co-authored-by: Sebastian Silbermann <[email protected]>

---------

Co-authored-by: Sebastian Silbermann <[email protected]>
* Convert "Canary" callouts to "React 19 beta" (#6811)

* Convert "Canary" callouts to "React 19 beta"

* Starting in

* Bump version string

* Bump deploy

* Bump deploy

* Bump deploy

* [19] Remove <NextMajor> callouts (#6844)

* Remove <NextMajor> callouts

* rm if(node)

* Delete removed APIs from 19 docs (#6845)

* Add information about ref handling in strict mode (#6777)

* Add information about DOM ref handling in strict mode

* switch order of ref object / ref callback in strictmode doc

* use 'refs to components' terminology instead of 'DOM refs'

* update references to canary/r19

* Expand usage example and remove badges

---------

Co-authored-by: Rick Hanlon <[email protected]>

* [19] s/"Server Action"/"Server Function" (#7180)

* [19] s/Server Action/Server Function

* Revert /blog and change redirect

* Add note

* Tweak note

* [v19] Update sandboxes to 19 RC (#7196)

* Update transition docs for React 19 (#6837)

* Add async transitions to React 19 docs

* Updates from feedback

* tweaks

* grammar

* Add startTranstion API

* Apply suggestions from code review

Co-authored-by: Noah Lemen <[email protected]>

* Updated

* capitalization

* grammar

---------

Co-authored-by: Noah Lemen <[email protected]>

* [19] Add docs for prerender APIs (#7320)

* Add prerender APIs

* fix code blocks

---------

Co-authored-by: Noah Lemen <[email protected]>
* fix links

* Update startTransition.md

* Update startTransition.md

* Update startTransition.md

* Update startTransition.md
"use-server" docs Server Functions href fixed.
* Fix stylesheet precedence example

* Update link.md

---------

Co-authored-by: dan <[email protected]>
docs: fixed typo act md counter fn grammar error
the “Dealing with rejected Promises” codesandbox example depends on react-error-boundary, but doesn’t specify it as a dependency, so the code example is broken
brookslybrand and others added 29 commits September 2, 2025 12:39
`a expensive` should be `an expensive`
Fix "documentatino" typo to "documentation" in comment about useOptimistic reference page.
…d example of the use API (#7767)

* Update "Deep Dive" in reusing-logic-with-custom-hooks.md with link to and example of the use API

* Remove mention of Server Components when explaining the use API

* Update src/content/learn/reusing-logic-with-custom-hooks.md

Co-authored-by: Ricky <[email protected]>

* fix: Correct which lines are highlighted in code example

---------

Co-authored-by: Ricky <[email protected]>
The previous examples used a service called loremflickr.com to link to  placeholder images. Since that service is now down, I updated them to reference placecats.com instead, which we already use in other examples as well. placecats doesn't have the same random cat feature so I roughly approximated it in the example code.

Closes #7966
* Fix handleClick compiler intro example

* Use a note instead

* Update src/content/learn/react-compiler/introduction.md
* fix: changed source file names in docs from App.js, index.js and styles.css to src/ dir

* fix: updated wrong image with the correct one with current sandbox file structure

* refactor: reverted all formatting and just just mention src folder in introductory section

* Reverted changes tutorial-tic-tac-toe.md

* added enhanced image of sandbox
* docs: add flushSync Troubleshooting section

* Update src/content/reference/react-dom/flushSync.md

* oops

* Apply suggestions from code review

* formatting and pitfall

---------

Co-authored-by: Ricky <[email protected]>
Co-authored-by: Rick Hanlon <[email protected]>
* correct IconExperimental naming and usage (from #7972)

Co-authored-by: Tuna <[email protected]>

* Bump Activity to Canary in docs

---------

Co-authored-by: Tuna <[email protected]>
Happened to notice we were still on an old version of the compiler. This PR upgrades us to use the latest RC.
Copied over our copyright script from the react repo. I made a small fix to handle shebangs.
* Add copyright script

Copied over our copyright script from the react repo. I made a small fix to handle shebangs.

* Update copyright on all files

Run the script.
…iler (#7988)

In facebook/react#34462 for example, we found an issue where the compiler was incorrectly validating an example straight from the docs.

In order to find more issues like this + also provide more feedback to doc authors on valid/invalid patterns, this PR adds a new local eslint rule which validates all markdown codeblocks containing components/hooks with React Compiler. An autofixer is also provided.

To express that a codeblock has an expected error, we can use the following metadata:

```ts
// pseudo type def
type MarkdownCodeBlockMetadata = {
    expectedErrors?: {
      'react-compiler'?: number[];
    };
  };
```

and can be used like so:

````
```js {expectedErrors: {'react-compiler': [4]}}
// ❌ setState directly in render
function Component({value}) {
  const [count, setCount] = useState(0);
  setCount(value); // error on L4
  return <div>{count}</div>;
}
```
````

Because this is defined as a local rule, we don't have the same granular reporting that `eslint-plugin-react-hooks` yet. I can look into that later but for now this first PR just sets us up with something basic.
* Add local eslint rule to validate markdown codeblocks with React Compiler

In facebook/react#34462 for example, we found an issue where the compiler was incorrectly validating an example straight from the docs.

In order to find more issues like this + also provide more feedback to doc authors on valid/invalid patterns, this PR adds a new local eslint rule which validates all markdown codeblocks containing components/hooks with React Compiler. An autofixer is also provided.

To express that a codeblock has an expected error, we can use the following metadata:

```ts
// pseudo type def
type MarkdownCodeBlockMetadata = {
    expectedErrors?: {
      'react-compiler'?: number[];
    };
  };
```

and can be used like so:

````
```js {expectedErrors: {'react-compiler': [4]}}
// ❌ setState directly in render
function Component({value}) {
  const [count, setCount] = useState(0);
  setCount(value); // error on L4
  return <div>{count}</div>;
}
```
````

Because this is defined as a local rule, we don't have the same granular reporting that `eslint-plugin-react-hooks` yet. I can look into that later but for now this first PR just sets us up with something basic.

* fix compiler errors

I went through the list of existing errors and tried to separate the expected errors from those that seem to be flagging unexpected issues.  In particular, our effects validations are flagging patterns that our own docs examples use. I added todos for these and will follow up later.
Previously, `createFileMap` split the MDX meta string on spaces and assumed the first token was the filename. Once we prefixed code fences with `{expectedErrors: ...}`, it would incorrectly parse the meta and crash.

This PR updates createFileMap to skip tokens in the meta containing a start and end brace pair (using a stack to ensure we close on the correct brace) while tokenizing the meta string as expected.

Test plan: pages reported in #7994 no longer crash on the next PR

Closes #7994
* Ignore braces when building Sandpack file map

Previously, `createFileMap` split the MDX meta string on spaces and assumed the first token was the filename. Once we prefixed code fences with `{expectedErrors: ...}`, it would incorrectly parse the meta and crash.

This PR updates createFileMap to skip tokens in the meta containing a start and end brace pair (using a stack to ensure we close on the correct brace) while tokenizing the meta string as expected.

Test plan: pages reported in #7994 no longer crash on the next PR

Closes #7994

* Restore lint corrections from #7989

Reverts the revert now that we've fixed the bug. These pages should no longer crash:

https://react-dev-git-pr7997-fbopensource.vercel.app/learn/referencing-values-with-refs
https://react-dev-git-pr7997-fbopensource.vercel.app/learn/synchronizing-with-effects
https://react-dev-git-pr7997-fbopensource.vercel.app/learn/separating-events-from-effects
https://react-dev-git-pr7997-fbopensource.vercel.app/learn/removing-effect-dependencies
https://react-dev-git-pr7997-fbopensource.vercel.app/learn/you-might-not-need-an-effect
For local dev and CI we want to have the eslint-local-rules running, so let's make sure both have their dependencies installed. We don't use a monorepo setup here, which is why they're currently setup as a two completely independent yarn workspaces.
Adds new docs for our new eslint rules.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment