Replace FIXME comment with explanation for JS safety in MutationObserver (#56271)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Rubén Norte authored and meta-codesync[bot] committed 2026-03-30 07:25:20 -07:00
1 parent 7f7cc0a544
commit 185a6130dd
1 file changed
+3 -2
@@ -116,8 +116,9 @@ void NativeMutationObserver::onMutations(std::vector<MutationRecord>& records) {
pendingRecords_.emplace_back(
NativeMutationRecord{
record.mutationObserverId,
// FIXME(T157129303) Instead of assuming we can call into JS from
// here, we should use an API that explicitly indicates it.
// It's safe to call into JS here because we only check mutations
// synchronously when committing from React (so we're in a JS
// task already).
getPublicInstanceFromShadowNode(*record.targetShadowNode),
getPublicInstancesFromShadowNodes(record.addedShadowNodes),
getPublicInstancesFromShadowNodes(record.removedShadowNodes)});