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

fix: move DelayedFreeze setImmediate into an effect #1980

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

amadeus
Copy link
Contributor

@amadeus amadeus commented Dec 2, 2023

Description

Executing side effects in render is usually considered bad manners in react land, and given concurrent rendering could have unexpected results if renders are thrown away.

Changes

This change makes it so setImmediate fires in an effect, and also cleans up after itself if for whatever reason the callback isn't fired. (although I think it's probably not possible with how setImmediate is implemented)

Screenshots / GIFs

N/A

Test code and steps to reproduce

We (at Discord) ran essentially this patch for probably over a year now without issue and figured it might be good to give back.

Here's an issue related to it: #1198

Checklist

Executing side effects in render is usually considered bad manners in
react land, and given concurrency, could have unexpected results if
renders are thrown away.  This change makes it so setImmediate fires in
an effect, and also cleans up after itself if for whatever reason the
callback isn't fired. (although I think it's probably not possible with
how setImmediate is implemented)
Copy link
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look solid.

Thanks for contributing 🙌🏻

@kkafar kkafar changed the title Move DelayedFreeze setImmediate into an effect fix: move DelayedFreeze setImmediate into an effect Dec 6, 2023
@kkafar kkafar merged commit c42cad0 into software-mansion:main Dec 6, 2023
3 checks passed
@amadeus amadeus deleted the delayed-freeze-fix branch December 6, 2023 16:50
@tboba
Copy link
Member

tboba commented Dec 7, 2023

Hi @amadeus! I'm happy to say that we've released new version of react-native-screens (3.29.0) which has this change included! 🥳

Check it out! If you find something wrong related to the newest version (this change is still buggy or doesn't work for you) let us know 🎉

renovate bot added a commit to valora-inc/wallet that referenced this pull request Jan 8, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[react-native-screens](https://togithub.com/software-mansion/react-native-screens)
| [`^3.27.0` ->
`^3.29.0`](https://renovatebot.com/diffs/npm/react-native-screens/3.27.0/3.29.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/react-native-screens/3.29.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-native-screens/3.29.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-native-screens/3.27.0/3.29.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-native-screens/3.27.0/3.29.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>software-mansion/react-native-screens
(react-native-screens)</summary>

###
[`v3.29.0`](https://togithub.com/software-mansion/react-native-screens/releases/tag/3.29.0)

[Compare
Source](https://togithub.com/software-mansion/react-native-screens/compare/3.28.0...3.29.0)

Minor release including fix for iOS that was accidentally omitted from
3.28.0. It should be now possible to present modal in outer stack, from
modal in nested stack (😄 )

#### What's Changed

#### 🐛 Bug fixes

- fix(iOS): select correct VC for nested modal presentation by
[@&#8203;kkafar](https://togithub.com/kkafar) in
[software-mansion/react-native-screens#1912

**Full Changelog**:
software-mansion/react-native-screens@3.28.0...3.29.0

###
[`v3.28.0`](https://togithub.com/software-mansion/react-native-screens/releases/tag/3.28.0)

[Compare
Source](https://togithub.com/software-mansion/react-native-screens/compare/3.27.0...3.28.0)

Minor release adding a support for **React Native 0.73**, adding new
iOS-like slide animation, fixing crashes with AVPlayer on iOS and
resolving build issues on Android.

#### What's Changed

#### 🐛 Bug fixes

- Update status bar & orientation in screen stack fragment by
[@&#8203;delphinebugner](https://togithub.com/delphinebugner) in
[software-mansion/react-native-screens#1934
- Set stateWrapper in ScreenViewManager in Fabric by
[@&#8203;joemun](https://togithub.com/joemun) in
[software-mansion/react-native-screens#1944
- Don't include AVPlayerView in `traverseForScrollView` method by
[@&#8203;tboba](https://togithub.com/tboba) in
[software-mansion/react-native-screens#1969
- Fix error about duplicate class ViewModelLazy by
[@&#8203;tboba](https://togithub.com/tboba) in
[software-mansion/react-native-screens#1977
- Move DelayedFreeze setImmediate into an effect by
[@&#8203;amadeus](https://togithub.com/amadeus) in
[software-mansion/react-native-screens#1980

#### 👍 Improvements

- Add ios like slide animation by
[@&#8203;alexandrius](https://togithub.com/alexandrius) in
[software-mansion/react-native-screens#1945

#### 🔢 Miscellaneous

- Support for RN 0.73 by [@&#8203;kkafar](https://togithub.com/kkafar)
in
[software-mansion/react-native-screens#1956
- Use JDK 17 for CI builds as required for RN 0.73 by
[@&#8203;kkafar](https://togithub.com/kkafar) in
[software-mansion/react-native-screens#1957
- Update Podfile.lock files in example projects by
[@&#8203;tboba](https://togithub.com/tboba) in
[software-mansion/react-native-screens#1979

#### New Contributors

- [@&#8203;delphinebugner](https://togithub.com/delphinebugner) made
their first contribution in
[software-mansion/react-native-screens#1934
- [@&#8203;joemun](https://togithub.com/joemun) made their first
contribution in
[software-mansion/react-native-screens#1944
- [@&#8203;alexandrius](https://togithub.com/alexandrius) made their
first contribution in
[software-mansion/react-native-screens#1945
- [@&#8203;amadeus](https://togithub.com/amadeus) made their first
contribution in
[software-mansion/react-native-screens#1980

**Full Changelog**:
software-mansion/react-native-screens@3.27.0...3.28.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone
America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone
America/Los_Angeles.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/valora-inc/wallet).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMjEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEyMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: valora-bot <valorabot@valoraapp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants