feat(session-replay-react-native)!: require explicit replay start - #1950
Conversation
Remove autoStart and replay-property stamping. Standalone consumers now initialize first and explicitly start recording. BREAKING CHANGE: SessionReplayConfig.autoStart and getSessionReplayProperties() are removed. Events are no longer stamped with session replay properties.
size-limit report 📦
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.
Reviewed by Cursor Bugbot for commit 9a796e4. Configure here.
There was a problem hiding this comment.
Pull request overview
This PR introduces a breaking API change for @amplitude/session-replay-react-native so that initialization only configures Session Replay and recording begins only after an explicit start() call. It also removes the cross-bridge “session replay properties” API and stops the RN standalone plugin and Segment plugin from stamping replay-correlation properties onto events.
Changes:
- Removed
autoStartfrom the standalone Session Replay config path and ensuredinit()no longer triggers recording automatically. - Removed
getSessionReplayProperties()from JS exports and native bridges, and removed event-enrichment/stamping logic in plugins. - Updated example app and unit/integration tests to reflect the new explicit-start and no-properties behavior.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/session-replay-react-native/test/session-replay.test.ts | Updates integration workflow test to require explicit start() and removes properties assertions. |
| packages/session-replay-react-native/test/plugin-session-replay.test.ts | Updates plugin tests for explicit start semantics and removes event stamping expectations. |
| packages/session-replay-react-native/test/index.test.ts | Updates public export tests to ensure getSessionReplayProperties is no longer exported and autoStart isn’t forwarded. |
| packages/session-replay-react-native/test/mocks/react-native.ts | Removes mocked native getSessionReplayProperties. |
| packages/session-replay-react-native/src/specs/NativeAmpSessionReplay.ts | Removes TurboModule spec method getSessionReplayProperties(). |
| packages/session-replay-react-native/src/session-replay.ts | Updates init/start docs and removes JS-side getSessionReplayProperties() implementation. |
| packages/session-replay-react-native/src/session-replay-config.ts | Removes standalone autoStart config and default. |
| packages/session-replay-react-native/src/plugin-session-replay.ts | Removes event stamping and switches plugin autoStart to call start() explicitly after setup. |
| packages/session-replay-react-native/src/native-module.ts | Removes native config/property types related to autoStart and properties API. |
| packages/session-replay-react-native/src/index.tsx | Removes getSessionReplayProperties from public exports. |
| packages/session-replay-react-native/ios/NativeSessionReplay.swift | Removes parsing/behavior for autoStart and removes native getSessionReplayProperties method. |
| packages/session-replay-react-native/ios/AMPNativeSessionReplay.mm | Removes exported ObjC bridge method for getSessionReplayProperties. |
| packages/session-replay-react-native/example/App.tsx | Updates example to call start() explicitly and removes properties usage/UI. |
| packages/session-replay-react-native/android/src/oldarch/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeSpec.kt | Removes old-arch spec method getSessionReplayProperties. |
| packages/session-replay-react-native/android/src/main/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeModule.kt | Removes properties bridge and forces autoStart = false on native setup. |
| packages/segment-session-replay-plugin-react-native/test/segment-session-replay-plugin.test.ts | Updates tests to stop expecting replay-property stamping. |
| packages/segment-session-replay-plugin-react-native/src/segment-session-replay-plugin.ts | Removes call to getSessionReplayProperties() so events are no longer enriched. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…onfigure The standalone SDK no longer auto-starts, so adding this plugin left recording off. Restore the previous behavior with a plugin-owned `autoStart` option (default true) that calls `start()` after `init()`. `autoStart` is stripped before `init()` so it is not forwarded across the native bridge, and the README no longer claims the plugin enriches events. Co-authored-by: Cursor <cursoragent@cursor.com>
|
why are we removing autostart? |
|
Standalone SDK on iOS and Flutter does not have autostart. Only android have this on standalone SDK, which historically been an outlier for the API parity. Autostart property remains unchanged on Segment and Amplitude SR plugins that are consuming the package. Since RN SR Standalone is in beta - there is no breaking change. I would make sure the Documentation is updated along with the GA |
Ah that makes sense 👍, thanks! |
Assert autoStart is omitted from native setup args, make the uninitialized plugin test skip setup, document that init() does not throw, and check the Segment plugin's execute() return value. Co-authored-by: Cursor <cursoragent@cursor.com>

Summary
autoStartfrom the standalone Session Replay configuration and require explicitstart()getSessionReplayProperties()across the JavaScript and native bridgesSDKRN-63
Checklist
Test plan
@amplitude/session-replay-react-native(54 tests)@amplitude/segment-session-replay-plugin-react-native(15 tests)pnpm docs:checkjest.setup.examples.jsis absent onorigin/mainPosted automatically with Cursor. LLMs make mistakes — please verify before acting.
Note
High Risk
Breaking public API: recording no longer starts on init, and replay metadata is no longer attached to analytics events. Existing RN/Segment integrations that relied on autoStart or getSessionReplayProperties will stop correlating or recording until they migrate.
Overview
Breaking:
init()only configures Session Replay. Callers muststart()to record.autoStartis removed fromSessionReplayConfigand the native setup payload (Android always constructs native SR withautoStart = false).Also breaking:
getSessionReplayProperties()is removed from JS, TurboModule spec, and iOS/Android bridges. Amplitude and Segment plugins no longer merge replay metadata onto events; they only sync session/device IDs.Plugins still auto-start by default:
SessionReplayPluginand newSegmentSessionReplayPluginConfig.autoStart(defaulttrue) callstart()after init so “add plugin and record” still works. SetautoStart: falseto start later.Example app and tests follow the new contract (
initthenstart, no property stamping).Reviewed by Cursor Bugbot for commit 76c31f2. Bugbot is set up for automated code reviews on this repo. Configure here.