Skip to content

Commit

Permalink
fix(frontend): correctly apply idle state to presenter
Browse files Browse the repository at this point in the history
  • Loading branch information
Harjot1Singh committed Aug 22, 2024
1 parent 3092bad commit cde0e2a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/frontend/src/features/presenter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import CssBaseline from '@mui/material/CssBaseline'
import IconButton from '@mui/material/IconButton'
import classNames from 'classnames'
import queryString from 'qs'
import { lazy, Suspense, useContext, useRef } from 'react'
import { lazy, Suspense, useContext, useRef, useState } from 'react'
import { EventsType, useIdleTimer } from 'react-idle-timer'
import { Route, Routes, useLocation, useNavigate } from 'react-router-dom'

Expand Down Expand Up @@ -59,10 +59,14 @@ const Presenter = () => {
const { search, pathname } = location
const { controllerOnly } = getUrlState( search )

const { isIdle } = useIdleTimer( {
const [ isIdle, setIsIdle ] = useState( false )

useIdleTimer( {
timeout: IDLE_TIMEOUT,
events: IDLE_EVENTS,
disabled: !isDesktop,
onIdle: () => setIsIdle( true ),
onActive: () => setIsIdle( false ),
} )

const lines = useCurrentLines()
Expand Down

0 comments on commit cde0e2a

Please sign in to comment.