From c2e95f8d98b12b83be927056c07867ede243881d Mon Sep 17 00:00:00 2001 From: Alex Kaminskii Date: Wed, 22 Jun 2022 15:56:27 +0200 Subject: [PATCH] fix(frontend): init player once --- frontend/app/components/Session/Session.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/frontend/app/components/Session/Session.js b/frontend/app/components/Session/Session.js index f7e93c493..c86d7d3e4 100644 --- a/frontend/app/components/Session/Session.js +++ b/frontend/app/components/Session/Session.js @@ -1,5 +1,5 @@ import React from 'react'; -import { useEffect } from 'react'; +import { useEffect, useState } from 'react'; import { connect } from 'react-redux'; import usePageTitle from 'App/hooks/usePageTitle'; import { fetch as fetchSession } from 'Duck/sessions'; @@ -21,18 +21,14 @@ function Session({ fetchSlackList, }) { usePageTitle("OpenReplay Session Player"); - // useEffect(() => { - // fetchSlackList() - // }, []); + const [ initializing, setInitializing ] = useState(true) useEffect(() => { if (sessionId != null) { fetchSession(sessionId) } else { console.error("No sessionID in route.") } - return () => { - if (!session.exists()) return; - } + setInitializing(false) },[ sessionId ]); return ( @@ -46,7 +42,7 @@ function Session({ } > - + { session.isIOS ? :