Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show a soft error when a text string or number is supplied as a child… #22109

Merged
merged 1 commit into from
Aug 17, 2021

Conversation

sota000
Copy link
Contributor

@sota000 sota000 commented Aug 17, 2021

Summary

Currently, React Native throws an invariant violation error when a text string or number is supplied as a child to non text wrappers like . This is undesirable because core library components should be fault-tolerant and degrade gracefully (with soft errors, if relevant). This change is only for the new React Native architecture.

There is a change I am making on the native side so that it doesn't hit an assertion / crash.

Test Plan

Modified the tests to account for the change.

Ran yarn test successfully.
Ran yarn test --prod successfully.
Ran yarn prettier successfully.
Ran yarn linc successfully.
Ran yarn flow fabric successfully.

@sizebot
Copy link

sizebot commented Aug 17, 2021

Comparing: 9b76d2d...ca4a182

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 = 127.50 kB 127.50 kB = 40.71 kB 40.71 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 130.32 kB 130.32 kB = 41.66 kB 41.66 kB
facebook-www/ReactDOM-prod.classic.js = 405.88 kB 405.88 kB = 74.97 kB 74.97 kB
facebook-www/ReactDOM-prod.modern.js = 394.58 kB 394.58 kB = 73.25 kB 73.25 kB
facebook-www/ReactDOMForked-prod.classic.js = 405.88 kB 405.88 kB = 74.97 kB 74.97 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against ca4a182

@sota000 sota000 marked this pull request as ready for review August 17, 2021 01:36
@rickhanlonii rickhanlonii merged commit bd25570 into facebook:main Aug 17, 2021
@sota000 sota000 deleted the invalid_text_fabric branch August 17, 2021 04:45
sota000 pushed a commit to sota000/react-native that referenced this pull request Aug 19, 2021
Summary:
This sync includes the following changes:
- **[bd255700d](facebook/react@bd255700d )**: Show a soft error when a text string or number is supplied as a child to non text wrappers ([facebook#22109](facebook/react#22109)) //<Sota>//

Changelog:
[General][Changed] - React Native sync for revisions 424fe58...bd25570

jest_e2e[run_all_tests]

Differential Revision: D30359243

fbshipit-source-id: 0642bf908a100f524678beb3358464d504710eac
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Aug 24, 2021
Summary:
Post: https://fb.workplace.com/groups/rnsyncsquad/permalink/879923262900946/

This sync includes the following changes:
- **[fc3b6a411](facebook/react@fc3b6a411 )**: Fix a few typos ([#22154](facebook/react#22154)) //<Bowen>//
- **[986d0e61d](facebook/react@986d0e61d )**: [Scheduler] Add tests for isInputPending ([#22140](facebook/react#22140)) //<Andrew Clark>//
- **[d54be90be](facebook/react@d54be90be )**: Set up test infra for dynamic Scheduler flags ([#22139](facebook/react#22139)) //<Andrew Clark>//
- **[7ed0706d7](facebook/react@7ed0706d7 )**: Remove the warning for setState on unmounted components ([#22114](facebook/react#22114)) //<Dan Abramov>//
- **[9eb2aaaf8](facebook/react@9eb2aaaf8 )**: Fixed ReactSharedInternals export in UMD bundle ([#22117](facebook/react#22117)) //<Brian Vaughn>//
- **[bd255700d](facebook/react@bd255700d )**: Show a soft error when a text string or number is supplied as a child to non text wrappers ([#22109](facebook/react#22109)) //<Sota>//

Changelog:
[General][Changed] - React Native sync for revisions 424fe58...bd5bf55

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D30485521

fbshipit-source-id: c5b92356e9e666eae94536ed31b8de43536419f8
zhengjitf pushed a commit to zhengjitf/react that referenced this pull request Apr 15, 2022
rozele added a commit to rozele/react that referenced this pull request Jun 12, 2024
…roper parent

In Fabric, we switched from using an invariant for text strings to a soft error in facebook#22109.

This change brings the same change to the Paper renderer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants