[Typo]: The mechanism described in "Providing a fallback for server errors and client-only content" behaves differently in practice
Personne n'a encore pris cette issue.
- Langage dominant
- JavaScript
- Étoiles
- 11.8k
- Forks
- 7.9k
- Merge moyen
- 1 j 11 h
- PR mergées (30 j)
- 11
Description
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
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).
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.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par la section de référence de React Suspense « Providing a fallback for server errors and client-only content », en particulier par les deux affirmations citées au sujet des erreurs serveur et de la désactivation du rendu côté serveur. Reproduisez ou vérifiez le comportement signalé en développement et en production, notamment l’erreur 419, puis mettez à jour la section afin que son explication corresponde au comportement observé et indique clairement toute limitation ou approche prise en charge.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, react
- Domaine
- documentation
- Type d'issue
- Documentation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 68/100