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(() => {<br /> amplitude.init(AMPLITUDE_API_KEY, {<br /> autocapture: {<br /> pageViews: false,<br /> formInteractions: false,<br /> },<br /> });<br /><br /> if (internalUser) {<br /> const sessionTrackingPlugin = sessionReplayPlugin();<br /><br /> amplitude.add(sessionTrackingPlugin);<br /> }<br /><br /><br /> amplitude.track(`PageView`, {<br /> url: `${document.location.origin}${document.location.pathname}`,<br /> path: `${document.location.pathname}`,<br /> queryParams: fromPairs(<br /> Array.from(new URLSearchParams(window.location.search).entries())<br /> ),<br /> });<br /> }, [internalUser]);
I’m using the latest version of the `BrowserSDK` and the `sessionReplayPlugin`