-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Transaction merging can cause CREATE
mutations to be effectively dropped
#47960
Comments
Tip Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - 0.76.3. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |
Tip Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |
Thanks for the report! I’m working on a fix under the disable_mount_item_reordering, please try it out. We’ve hit some issues rolling that out internally, but we can try and prioritise this. |
Note that transaction merging is fairly recent, but the underlying crash has been around for a while. |
Thanks for pointing it out! I've been testing on the Expensify App so I missed it 🤦. I've tried enabling the flag on the repro from this issue and unfortunately, it doesn't help - the crash happens when clicking the first button (which changes As a side note, do you see any obvious problems with disabling the transaction merging and queuing more than one instead? |
Transaction merging (which just appends them really) is required to correctly implement cascading renders from effects in the new architecture. Otherwise, it's possible to observe the intermediate states which is not correct. |
…n-existent nodes Summary: Demonstrates the issue identified in facebook#47960 and a crash we've been seeing internally around `getViewState` referencing a view that does not exist. When reparenting unflattened nodes, Differentiator may emit an `update` with a `parentShadowView` that does not exist on the native side yet, thereby crashing Android. Landing the test-case first (with some test cleanup), so the diff for the actual fix is clearer. Changelog: [Internal] Differential Revision: D66557919
I've narrowed down this repro to a mounting unit test in #48002 |
…n-existent nodes (#48002) Summary: Pull Request resolved: #48002 Demonstrates the issue identified in #47960 and a crash we've been seeing internally around `getViewState` referencing a view that does not exist. When reparenting unflattened nodes, Differentiator may emit an `update` with a `parentShadowView` that does not exist on the native side yet, thereby crashing Android. Landing the test-case first (with some test cleanup), so the diff for the actual fix is clearer. Changelog: [Internal] Reviewed By: lenaic Differential Revision: D66557919 fbshipit-source-id: 5428c32e5f0200a8e98568cabeedb0c61aafbe23
I have my app migrated to EXPO SDK 52 recently and this bug happens ALL the times on a given screen, I can't release my app until this is fixed ? |
Description
Related to #38743
Transaction merging introduced in #44188 may cause
CREATE
mutations to be effectively dropped.When two transactions, where the first one contains a
DELETE
mutation for a view with a view tagX
and the other contains aCREATE
mutation for a view with a view tagX
, get merged the result is a transaction containing both mutations. When that transaction is executed, theDELETE
operations are run afterCREATE
operations, so the view will not exist after the transaction finishes which results in the host tree diverging from the shadow tree.Inside
FabricUIManagerBinding
pendingTransactions_
field tracks transactions to be executed but only one per surface:react-native/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.h
Lines 164 to 166 in a6b2355
Inside
schedulerDidFinishTransaction
transactions are merged when a transaction for a given surface is already pending:react-native/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp
Lines 546 to 550 in a6b2355
If instead of merging transactions into one, multiple ones could be queued for a single surface and executed in order, the issue would be fixed. I can open a PR with that change but before that, I'd like to know whether that could have any unwanted side effects, as I'm lacking context on why merging was chosen there.
It also seems like this may be a known problem:
react-native/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp
Lines 828 to 829 in 69356b7
Steps to reproduce
Click this first
buttonClick this second
buttonReact Native Version
0.76.2
Affected Platforms
Runtime - Android
Areas
Fabric - The New Renderer
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://snack.expo.dev/@jpiasecki/unable_to_find_viewstate_repro
Screenshots and Videos
Screen.Recording.2024-11-26.at.13.18.17.mov
The text was updated successfully, but these errors were encountered: