What happened?
We have a component which instantiates useIdleTimer using a lazy-loaded boolean value for crossTab (we default to false until we finish loading the actual value). The component rerenders when the boolean value has been loaded and may be set to true. If the user takes no action before this rerender, then isLastActiveTab() will always return false, even if there is only one tab.
Reproduction Steps
1. Create a component which accepts a boolean prop and uses the useIdleTimer hook, setting crossTab to the prop value.
2. In the parent component, create a state variable which defaults to false, create a setTimeout which will flip it to true after 100ms, and pass that into the child component in step 1.
3. Add some logging or display the status of isLastActiveTab() in a modal that is shown when `onPrompt` is called.
4. Notice that when refreshing and doing nothing, isLastActiveTab() is false. When refreshing and moving the mouse after the 100ms timeout, isLastActiveTab() is true
Relevant log output
Screenshots or Additional Context
I have created a codesandbox example which reproduces this behavior here:
https://codesandbox.io/p/sandbox/react-idle-timer-repro-2yv78s
IdleTimerContainer.js contains the idle timer, App.js sets and flips the boolean prop as described in the steps above.
Module Version
5.7.2
What browsers are you seeing the problem on? Select all that apply.
Chrome
What devices are you seeing the problem on?
Desktop
Verification
What happened?
We have a component which instantiates
useIdleTimerusing a lazy-loaded boolean value forcrossTab(we default to false until we finish loading the actual value). The component rerenders when the boolean value has been loaded and may be set to true. If the user takes no action before this rerender, thenisLastActiveTab()will always return false, even if there is only one tab.Reproduction Steps
Relevant log output
Screenshots or Additional Context
I have created a codesandbox example which reproduces this behavior here:
https://codesandbox.io/p/sandbox/react-idle-timer-repro-2yv78s
IdleTimerContainer.jscontains the idle timer,App.jssets and flips the boolean prop as described in the steps above.Module Version
5.7.2
What browsers are you seeing the problem on? Select all that apply.
Chrome
What devices are you seeing the problem on?
Desktop
Verification