reactjs / reactjs/react.dev

[Typo]: The mechanism described in "Providing a fallback for server errors and client-only content" behaves differently in practice

Aberta Para iniciantes
#8,497 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

type: typos
Linguagem predominante
JavaScript
Estrelas
11.8k
Forks
7.9k
Merge médio
1d 11h
PRs com merge (30d)
11

Descrição

Summary

The section "Providing a fallback for server errors and client-only content" could be misleading when it comes to opting out of server-rendering.

Page

https://react.dev/reference/react/Suspense#providing-a-fallback-for-server-errors-and-client-only-content

Details

The section "Providing a fallback for server errors and client-only content" seems to suggest that if a user wants to explicitly opt out a component/hook out of being rendered on the server, they can throw an error on the server, and when that same component successfully renders on the client, the error will not be surfaced to the user. I am specifically talking about the following statements:

However, if it does not error on the client, React will not display the error to the user since the content was eventually displayed successfully.

You can use this to opt out some components from rendering on the server. To do this, throw an error in the server environment and then wrap them in a boundary to replace their HTML with fallbacks:

That seems to be in opposition to how React behaves in practice. Both in development and in production, the error thrown on the server is surfaced to the developer, and (arguably) the end user through the browser console (Minified error description: https://react.dev/errors/419).

Image

The seems to be no documented way to distinguish an intended opt-out from a user error, and if there is none, I feel like the documentation is a bit misleading.

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece pela seção de referência do React Suspense “Providing a fallback for server errors and client-only content”, especialmente pelas duas afirmações citadas sobre erros do servidor e sobre optar por não usar a renderização no servidor. Reproduza ou verifique o comportamento relatado em desenvolvimento e produção, incluindo o erro 419, e então atualize a seção para que sua explicação corresponda ao comportamento observado e declare claramente qualquer limitação ou abordagem compatível.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
javascript, react
Domínio
documentation
Tipo de issue
Documentação
Dificuldade
2/5
Tempo estimado
1-3 horas
Status de atividade
Pouca atividade
Clareza
Razoavelmente clara
Facilidade para iniciantes
68/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.