Hey folks, I’m running into an issue where I can’t correctly conditionally add/remove the session replay plug in. The replays either don’t get generated or when it does, the replay is stuck at the loading spinner.
This is the snippet where I initialize the Amplitude client in my React App.
React.useEffect(() => {
amplitude.init(AMPLITUDE_API_KEY, {
autocapture: {
pageViews: false,
formInteractions: false,
},
});
if (internalUser) {
const sessionTrackingPlugin = sessionReplayPlugin();
amplitude.add(sessionTrackingPlugin);
}
amplitude.track(`PageView`, {
url: `${document.location.origin}${document.location.pathname}`,
path: `${document.location.pathname}`,
queryParams: fromPairs(
Array.from(new URLSearchParams(window.location.search).entries())
),
});
}, internalUser]);
I’m using the latest version of the `BrowserSDK` and the `sessionReplayPlugin`