From b3df4576169d2be61dbf4cfe3f517e1f61503dfc Mon Sep 17 00:00:00 2001 From: Sergio Barrio Date: Thu, 16 Apr 2026 17:18:51 +0200 Subject: [PATCH 1/4] Fix SR podspec to rely on install_modules_dependencies for New Arch setup --- .../DatadogSDKReactNativeSessionReplay.podspec | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec b/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec index d354b40c0..70e0965ca 100644 --- a/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec +++ b/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec @@ -1,7 +1,6 @@ require "json" package = JSON.parse(File.read(File.join(__dir__, "package.json"))) -folly_compiler_flags = '-DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' Pod::Spec.new do |s| s.name = "DatadogSDKReactNativeSessionReplay" @@ -49,17 +48,16 @@ Pod::Spec.new do |s| } if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then - s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1" - xcconfig.merge!({ "DEFINES_MODULE" => "YES", + "OTHER_CPLUSPLUSFLAGS" => "-DRCT_NEW_ARCH_ENABLED=1", "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }) - end - s.pod_target_xcconfig = xcconfig + s.pod_target_xcconfig = xcconfig - if respond_to?(:install_modules_dependencies, true) install_modules_dependencies(s) + else + s.pod_target_xcconfig = xcconfig end end From 08fd12aaab390bb35d251fc8b936ee8fadefda06 Mon Sep 17 00:00:00 2001 From: Sergio Barrio Date: Fri, 17 Apr 2026 11:44:34 +0200 Subject: [PATCH 2/4] Fix podspec for RN0.71 / Fix withSessionReplayAssetBundler no avoid locking up node --- .../DatadogSDKReactNativeSessionReplay.podspec | 3 ++- .../src/metro/index.ts | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec b/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec index 70e0965ca..fde89026b 100644 --- a/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec +++ b/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec @@ -48,9 +48,10 @@ Pod::Spec.new do |s| } if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then + s.compiler_flags = "-DRCT_NEW_ARCH_ENABLED=1" + xcconfig.merge!({ "DEFINES_MODULE" => "YES", - "OTHER_CPLUSPLUSFLAGS" => "-DRCT_NEW_ARCH_ENABLED=1", "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }) diff --git a/packages/react-native-session-replay/src/metro/index.ts b/packages/react-native-session-replay/src/metro/index.ts index b61a3abc5..2b9422cd7 100644 --- a/packages/react-native-session-replay/src/metro/index.ts +++ b/packages/react-native-session-replay/src/metro/index.ts @@ -11,7 +11,7 @@ import path from 'path'; import { mergeSvgAssets } from './processing'; import { debounce } from './utils'; -let watching = false; +let watcher: chokidar.FSWatcher | null = null; const MERGE_DEBOUNCE_MS = 300; const WATCH_STABILITY_THRESHOLD_MS = 200; @@ -38,9 +38,8 @@ export function withSessionReplayAssetBundler(metroConfig: any): any { }, MERGE_DEBOUNCE_MS); // Prevent potential multiple watchers if metro loads the config multiple times - if (!watching) { - watching = true; - chokidar + if (!watcher) { + watcher = chokidar .watch(assetsDir, { // Skip events for files that already exist ignoreInitial: true, @@ -75,6 +74,14 @@ export function withSessionReplayAssetBundler(metroConfig: any): any { event.type === 'transformer_load_done' ) { mergeSvgAssets(assetsDir); + + // Close the file watcher after bundling completes + // This prevents the chokidar watcher from keeping the + // Node process alive during release/CI builds + if (watcher) { + watcher.close(); + watcher = null; + } } } } From f8483d173f7b87169ff99c9ac30f270b20334221 Mon Sep 17 00:00:00 2001 From: Sergio Barrio Date: Fri, 17 Apr 2026 11:56:19 +0200 Subject: [PATCH 3/4] Fix chokidar.watch typing issue --- packages/react-native-session-replay/src/metro/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-session-replay/src/metro/index.ts b/packages/react-native-session-replay/src/metro/index.ts index 2b9422cd7..c4f30a2e2 100644 --- a/packages/react-native-session-replay/src/metro/index.ts +++ b/packages/react-native-session-replay/src/metro/index.ts @@ -11,7 +11,7 @@ import path from 'path'; import { mergeSvgAssets } from './processing'; import { debounce } from './utils'; -let watcher: chokidar.FSWatcher | null = null; +let watcher: ReturnType | null = null; const MERGE_DEBOUNCE_MS = 300; const WATCH_STABILITY_THRESHOLD_MS = 200; From d10bd538d01bda27df45817f14e43ccb6ed64915 Mon Sep 17 00:00:00 2001 From: Sergio Barrio Date: Fri, 17 Apr 2026 15:32:42 +0200 Subject: [PATCH 4/4] Add version guard on SR podspec --- .../DatadogSDKReactNativeSessionReplay.podspec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec b/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec index fde89026b..9b3c11767 100644 --- a/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec +++ b/packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec @@ -57,7 +57,12 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = xcconfig - install_modules_dependencies(s) + # install_modules_dependencies is only available on RN >= 0.71 + if respond_to?(:install_modules_dependencies, true) + install_modules_dependencies(s) + else + Pod::UI.warn "Using Datadog React Native Session Replay with new architecture on RN < 0.71 is discouraged and not officially supported." + end else s.pod_target_xcconfig = xcconfig end