Skip to content

Commit 185a613

Browse files
rubennortemeta-codesync[bot]
authored andcommitted
Replace FIXME comment with explanation for JS safety in MutationObserver (#56271)
Summary: Pull Request resolved: #56271 Replace the FIXME(T157129303) comment in NativeMutationObserver with a clarifying comment explaining why it is safe to call into JS at that point: we only check mutations synchronously when committing from React, so we are already in a JS task. Changelog: [Internal] Reviewed By: javache Differential Revision: D98714071 fbshipit-source-id: 90738e9ec6e2215dff331a3b714373bf52f4b24b
1 parent 7f7cc0a commit 185a613

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/react-native/ReactCommon/react/nativemodule/mutationobserver/NativeMutationObserver.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@ void NativeMutationObserver::onMutations(std::vector<MutationRecord>& records) {
116116
pendingRecords_.emplace_back(
117117
NativeMutationRecord{
118118
record.mutationObserverId,
119-
// FIXME(T157129303) Instead of assuming we can call into JS from
120-
// here, we should use an API that explicitly indicates it.
119+
// It's safe to call into JS here because we only check mutations
120+
// synchronously when committing from React (so we're in a JS
121+
// task already).
121122
getPublicInstanceFromShadowNode(*record.targetShadowNode),
122123
getPublicInstancesFromShadowNodes(record.addedShadowNodes),
123124
getPublicInstancesFromShadowNodes(record.removedShadowNodes)});

0 commit comments

Comments
 (0)