GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Improving feedback for "Text strings must be rendered within a <Text> component." errors. by dmlux · Pull Request #20803 · react/react

Conversation

@dmlux

@dmlux dmlux commented Feb 11, 2021

Copy link
Copy Markdown

Summary

This PR is meant to be a draft for changes in the renderer. In our company we sometimes facing "Text strings must be rendered within a <Text> component." errors related to conditional concatenation with components. Since conditionals are often values provided by services, it is difficult to track down the exact location where they occur. Unfortunately, both the error component stack and the call stack do not provide enough information to find the corresponding location in the code. For this reason, we patched React Native locally to drastically reduce the debugging time associated with such errors.

The provided changes of this PR are basically the patch applied locally to React Native in our project. The improvements to the messages from our patch include the actual text that could not be rendered, as well as a sibling component and its exact location in the source code. This allows my colleagues and me to quickly track down problems and locate the approximate point of failure in our code. It also gives a hint that the problem might be related to a concatenation between a value and a component.

However, this solution is not quite perfect, as the information is not detailed enough in cases where the error is caused by code, such as the following:

<View>
  forgot to wrap this text with text component...
</View>

Obviously, in this situation, there are no sibling components from which we can infer the source code location or parent component. Nevertheless, in such cases the message contains at least the text which could not be rendered without <Text> component. The question we have is whether it is possible to make the error message more verbose in all cases?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pke and azahariev reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
dnslx added 2 commits February 11, 2021 15:07
@dnslx
refactor: improves error messages for text issues
b945eaf
@dnslx
fix: fixes text issues
3ab7c76
@facebook-github-bot

facebook-github-bot commented Feb 11, 2021

Copy link
Copy Markdown
Contributor

Hi @dmlux!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pke

pke commented Feb 11, 2021

Copy link
Copy Markdown

I wonder is there way to display additional information in the error box like a hint for the developer how to fix the error?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sizebot

sizebot commented Feb 11, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Comparing: 483358c...5483801

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 122.34 kB 122.34 kB = 39.40 kB 39.40 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 128.92 kB 128.92 kB = 41.46 kB 41.46 kB
facebook-www/ReactDOM-prod.classic.js = 404.69 kB 404.69 kB = 75.17 kB 75.17 kB
facebook-www/ReactDOM-prod.modern.js = 393.04 kB 393.04 kB = 73.27 kB 73.27 kB
facebook-www/ReactDOMForked-prod.classic.js = 404.70 kB 404.70 kB = 75.17 kB 75.18 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
react-native/implementations/ReactNativeRenderer-prod.fb.js +0.40% 279.51 kB 280.62 kB +0.53% 50.08 kB 50.35 kB
react-native/implementations/ReactNativeRenderer-prod.js +0.40% 279.57 kB 280.68 kB +0.52% 50.11 kB 50.38 kB
react-native/implementations/ReactFabric-prod.fb.js +0.40% 272.08 kB 273.16 kB +0.50% 48.72 kB 48.97 kB
react-native/implementations/ReactFabric-prod.js +0.40% 272.13 kB 273.21 kB +0.50% 48.75 kB 48.99 kB
react-native/implementations/ReactNativeRenderer-profiling.fb.js +0.38% 292.17 kB 293.29 kB +0.50% 52.41 kB 52.67 kB
react-native/implementations/ReactNativeRenderer-profiling.js +0.38% 292.23 kB 293.35 kB +0.50% 52.44 kB 52.70 kB
react-native/implementations/ReactFabric-profiling.fb.js +0.38% 284.78 kB 285.85 kB +0.52% 51.06 kB 51.32 kB
react-native/implementations/ReactFabric-profiling.js +0.38% 284.83 kB 285.91 kB +0.52% 51.08 kB 51.35 kB

Generated by 🚫 dangerJS against 5483801

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dnslx
refactor: applies prettier changes
74f0336
@facebook-github-bot facebook-github-bot added the CLA Signed label Feb 11, 2021
@facebook-github-bot

facebook-github-bot commented Feb 11, 2021

Copy link
Copy Markdown
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dnslx
refactor: updates error map
5483801
@rickhanlonii
rickhanlonii requested a review from yungsters February 23, 2021 06:05
@yungsters

yungsters commented Feb 23, 2021

Copy link
Copy Markdown
Contributor

I previously attempted this in #19581, but I reverted it in #19723 because of feedback that I received (from @sebmarkbage, IIRC) around security implications of logging arbitrarily user-generated content.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stale

stale Bot commented Jun 11, 2021

Copy link
Copy Markdown

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stale stale Bot added the Resolution: Stale Automatically closed due to inactivity label Jun 11, 2021
@pke

pke commented Jun 11, 2021

Copy link
Copy Markdown

Commenting to keep this PR open. Would be nice to improve the developer experience with that PR

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stale stale Bot removed the Resolution: Stale Automatically closed due to inactivity label Jun 11, 2021
@stale

stale Bot commented Jan 9, 2022

Copy link
Copy Markdown

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stale stale Bot added the Resolution: Stale Automatically closed due to inactivity label Jan 9, 2022
@yungsters

yungsters commented Jan 9, 2022

Copy link
Copy Markdown
Contributor

There is another open PR that I just commented on last week to do this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stale stale Bot removed the Resolution: Stale Automatically closed due to inactivity label Jan 9, 2022
@yungsters

yungsters commented Jan 9, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

See #22725.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sebmarkbage
sebmarkbage deleted the branch react:master October 20, 2022 20:41
@sebmarkbage sebmarkbage closed this Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@yungsters yungsters Awaiting requested review from yungsters

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA Signed

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@dmlux @facebook-github-bot @pke @sizebot @yungsters @sebmarkbage @dnslx
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.