Skip to content

Conversation

alfonsocj
Copy link
Contributor

@alfonsocj alfonsocj commented Feb 17, 2022

Summary

Fixes the infinite loop explained in the issue #33129 by reverting commit 5902152. PR #31538.

onCollectExtraUpdates is part of the node update cycle. By marking the node as updated markUpdated() in onCollectExtraUpdates we are restarting the update infinitely.

Unfortunately, reverting this PR also reintroduces the original issue #30717 which IMO is minor compared to the infinite loop.

Changelog

[Android] [Fixed] - Text with adjustsFontSizeToFit changes the text layout infinitely

Test Plan

I added a console.log to the Text onTextLayout in packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js to see if the infinite loop is gone.

image

Screen Shot 2022-02-17 at 11 20 31 AM

@facebook-github-bot
Copy link
Contributor

Hi @alfonsocj!

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!

@react-native-bot react-native-bot added Bug Platform: Android Android applications. labels Feb 17, 2022
@shergin
Copy link
Contributor

shergin commented Feb 17, 2022

Yeah, as the author of the original fix (being reverted here), I believe we should back it out because it introduces way more problems than solves.

@shergin
Copy link
Contributor

shergin commented Feb 17, 2022

@lunaleaps hey, hey! if you are still managing the release process, I believe it should be added to a patch version. 🙇

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 17, 2022
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Feb 17, 2022
@lunaleaps
Copy link
Contributor

Hey @shergin! Glad to hear from you! Sounds good, I'll put it as a comment on our releases discussion group. It's where we generally make cherry-picks for stable/pre-release now!

@facebook-github-bot
Copy link
Contributor

@lunaleaps has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@alfonsocj
Copy link
Contributor Author

alfonsocj commented Feb 17, 2022

Thanks @lunaleaps! Can we also try to include this fix in the discussion for 0.66.5? I'm not sure if you fix previous versions as well.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by Alfonso Curbelo in c1db41f.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Feb 17, 2022
@lunaleaps
Copy link
Contributor

Thanks @lunaleaps! Can we also try to include this fix in the discussion for 0.66.5? I'm not sure if you fix previous versions as well.

Generally no, we usually only target the current stable or release candidate.

ShikaSD pushed a commit that referenced this pull request Feb 22, 2022
…tely (#33135)

Summary:
Fixes the infinite loop explained in the issue #33129 by reverting commit  5902152. PR #31538.

`onCollectExtraUpdates` is part of the node update cycle. By marking the node as updated `markUpdated()` in `onCollectExtraUpdates` we are restarting the update infinitely.

Unfortunately, reverting this PR also reintroduces the original issue #30717 which IMO is minor compared to the infinite loop.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - Text with adjustsFontSizeToFit changes the text layout infinitely

Pull Request resolved: #33135

Test Plan:
I added a console.log to the Text `onTextLayout` in [packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js ](https://github.com/facebook/react-native/blob/main/packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js) to see if the infinite loop is gone.

![image](https://user-images.githubusercontent.com/3791120/154523914-e6aa7cf5-7a1c-488f-a392-898f4c85a833.png)

![Screen Shot 2022-02-17 at 11 20 31 AM](https://user-images.githubusercontent.com/3791120/154524274-880c3bed-d2c6-456b-8947-42e75793c424.jpg)

```

Reviewed By: ShikaSD

Differential Revision: D34310218

Pulled By: lunaleaps

fbshipit-source-id: 0d40f49d15c562ec25983145897bd95dc182f897
ShikaSD pushed a commit that referenced this pull request Feb 24, 2022
…tely (#33135)

Summary:
Fixes the infinite loop explained in the issue #33129 by reverting commit  5902152. PR #31538.

`onCollectExtraUpdates` is part of the node update cycle. By marking the node as updated `markUpdated()` in `onCollectExtraUpdates` we are restarting the update infinitely.

Unfortunately, reverting this PR also reintroduces the original issue #30717 which IMO is minor compared to the infinite loop.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - Text with adjustsFontSizeToFit changes the text layout infinitely

Pull Request resolved: #33135

Test Plan:
I added a console.log to the Text `onTextLayout` in [packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js ](https://github.com/facebook/react-native/blob/main/packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js) to see if the infinite loop is gone.

![image](https://user-images.githubusercontent.com/3791120/154523914-e6aa7cf5-7a1c-488f-a392-898f4c85a833.png)

![Screen Shot 2022-02-17 at 11 20 31 AM](https://user-images.githubusercontent.com/3791120/154524274-880c3bed-d2c6-456b-8947-42e75793c424.jpg)

```

Reviewed By: ShikaSD

Differential Revision: D34310218

Pulled By: lunaleaps

fbshipit-source-id: 0d40f49d15c562ec25983145897bd95dc182f897
@Orange9000
Copy link

Is there a way to apply this fix without upgrading react-native? I tried patching react-native package, but that doesn't seem to do anything, as if module remains unchanged.

Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this pull request Jan 15, 2023
…tely (facebook#33135)

Summary:
Fixes the infinite loop explained in the issue facebook#33129 by reverting commit  5902152. PR facebook#31538.

`onCollectExtraUpdates` is part of the node update cycle. By marking the node as updated `markUpdated()` in `onCollectExtraUpdates` we are restarting the update infinitely.

Unfortunately, reverting this PR also reintroduces the original issue facebook#30717 which IMO is minor compared to the infinite loop.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - Text with adjustsFontSizeToFit changes the text layout infinitely

Pull Request resolved: facebook#33135

Test Plan:
I added a console.log to the Text `onTextLayout` in [packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js ](https://github.com/facebook/react-native/blob/main/packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js) to see if the infinite loop is gone.

![image](https://user-images.githubusercontent.com/3791120/154523914-e6aa7cf5-7a1c-488f-a392-898f4c85a833.png)

![Screen Shot 2022-02-17 at 11 20 31 AM](https://user-images.githubusercontent.com/3791120/154524274-880c3bed-d2c6-456b-8947-42e75793c424.jpg)

```

Reviewed By: ShikaSD

Differential Revision: D34310218

Pulled By: lunaleaps

fbshipit-source-id: 0d40f49d15c562ec25983145897bd95dc182f897
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Platform: Android Android applications. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants