diff --git a/frontend/app/components/Session/Session.js b/frontend/app/components/Session/Session.js index a218b4ca9..75a96433b 100644 --- a/frontend/app/components/Session/Session.js +++ b/frontend/app/components/Session/Session.js @@ -2,7 +2,7 @@ import React from 'react'; import { useEffect, useState } from 'react'; import { connect } from 'react-redux'; import usePageTitle from 'App/hooks/usePageTitle'; -import { fetchV2 } from "Duck/sessions"; +import { fetchV2, clearCurrentSession } from "Duck/sessions"; import { fetchList as fetchSlackList } from 'Duck/integrations/slack'; import { Link, NoContent, Loader } from 'UI'; import { sessions as sessionsRoute } from 'App/routes'; @@ -18,6 +18,7 @@ function Session({ loading, hasErrors, fetchV2, + clearCurrentSession, }) { usePageTitle("OpenReplay Session Player"); const [ initializing, setInitializing ] = useState(true) @@ -29,6 +30,9 @@ function Session({ console.error("No sessionID in route.") } setInitializing(false) + return () => { + clearCurrentSession(); + } },[ sessionId ]); useEffect(() => { @@ -65,4 +69,5 @@ export default withPermissions(['SESSION_REPLAY'], '', true)(connect((state, pro }, { fetchSlackList, fetchV2, + clearCurrentSession, })(Session)); diff --git a/frontend/app/components/shared/SessionListContainer/SessionListContainer.tsx b/frontend/app/components/shared/SessionListContainer/SessionListContainer.tsx index 67b1e12e7..e3bc98b62 100644 --- a/frontend/app/components/shared/SessionListContainer/SessionListContainer.tsx +++ b/frontend/app/components/shared/SessionListContainer/SessionListContainer.tsx @@ -3,18 +3,22 @@ import SessionList from './components/SessionList'; import SessionHeader from './components/SessionHeader'; import NotesList from './components/Notes/NoteList'; import { connect } from 'react-redux'; -import { fetchList as fetchMembers } from 'Duck/member'; import LatestSessionsMessage from './components/LatestSessionsMessage'; +import { clearCurrentSession } from "Duck/sessions"; function SessionListContainer({ activeTab, - fetchMembers, members, + clearCurrentSession, }: { activeTab: string; fetchMembers: () => void; members: object[]; + clearCurrentSession: () => void; }) { + React.useEffect(() => { + clearCurrentSession() + }, []) return (