fix(ui) - session call made twice

This commit is contained in:
Shekar Siri 2022-03-04 10:53:12 +01:00
parent 67f436dd72
commit d57959199b
2 changed files with 26 additions and 35 deletions

View file

@ -60,14 +60,11 @@ export default withRequest({
loadingName: 'loadingCredentials',
})(withPermissions(['ASSIST_LIVE'], '', true)(connect(
state => {
// const isAssist = state.getIn(['sessions', 'activeTab']).type === 'live';
// const hasSessioPath = state.getIn([ 'sessions', 'sessionPath' ]).includes('/sessions');
return {
session: state.getIn([ 'sessions', 'current' ]),
showAssist: state.getIn([ 'sessions', 'showChatWindow' ]),
jwt: state.get('jwt'),
fullscreen: state.getIn([ 'components', 'player', 'fullscreen' ]),
// hasSessionsPath: hasSessioPath && !isAssist,
isEnterprise: state.getIn([ 'user', 'client', 'edition' ]) === 'ee',
hasErrors: !!state.getIn([ 'sessions', 'errors' ]),
}

View file

@ -6,8 +6,6 @@ import { fetchList as fetchSlackList } from 'Duck/integrations/slack';
import { Link, NoContent, Loader } from 'UI';
import { sessions as sessionsRoute } from 'App/routes';
import withPermissions from 'HOCs/withPermissions'
import LivePlayer from './LivePlayer';
import WebPlayer from './WebPlayer';
import IOSPlayer from './IOSPlayer';
@ -20,7 +18,6 @@ function Session({
session,
fetchSession,
fetchSlackList,
hasSessionsPath
}) {
usePageTitle("OpenReplay Session Player");
useEffect(() => {
@ -35,41 +32,38 @@ function Session({
return () => {
if (!session.exists()) return;
}
},[ sessionId, hasSessionsPath ]);
},[ sessionId ]);
return (
<NoContent
show={ hasErrors }
title="Session not found."
subtext={
<span>
{'Please check your data retention plan, or try '}
<Link to={ SESSIONS_ROUTE }>{'another one'}</Link>
</span>
}
>
<Loader className="flex-1" loading={ loading || sessionId !== session.sessionId }>
{ session.isIOS
? <IOSPlayer session={session} />
: <WebPlayer />
}
</Loader>
</NoContent>
show={ hasErrors }
title="Session not found."
subtext={
<span>
{'Please check your data retention plan, or try '}
<Link to={ SESSIONS_ROUTE }>{'another one'}</Link>
</span>
}
>
<Loader className="flex-1" loading={ loading || sessionId !== session.sessionId }>
{ session.isIOS
? <IOSPlayer session={session} />
: <WebPlayer />
}
</Loader>
</NoContent>
);
}
export default withPermissions(['SESSION_REPLAY'], '', true)(connect((state, props) => {
const { match: { params: { sessionId } } } = props;
const isAssist = state.getIn(['sessions', 'activeTab']).type === 'live';
const hasSessiosPath = state.getIn([ 'sessions', 'sessionPath' ]).includes('/sessions');
return {
sessionId,
loading: state.getIn([ 'sessions', 'loading' ]),
hasErrors: !!state.getIn([ 'sessions', 'errors' ]),
session: state.getIn([ 'sessions', 'current' ]),
hasSessionsPath: hasSessiosPath && !isAssist,
};
}, {
fetchSession,
fetchSlackList,
return {
sessionId,
loading: state.getIn([ 'sessions', 'loading' ]),
hasErrors: !!state.getIn([ 'sessions', 'errors' ]),
session: state.getIn([ 'sessions', 'current' ]),
};
}, {
fetchSession,
fetchSlackList,
})(Session));