Description
What happened?
Trying to control an "Extend session" prompt dialog using isPrompted
.
In React, using a Dialog component with an isOpen
prop requires use of a React state variable so that the component will re-render when the state (isPrompted) is changing. However, since idle-timer provides only a function, and not a hook-based boolean state, we can't detect when the state is changing, and therefore must use our own managed state value which is set by the onActive
, onIdle
, and onPrompt
event handlers. This makes the isPrompted
function redundant and not useful.
This could be made more useful by including and managing these states internally in the useIdletimer
hook and returning them along with the other return values/objects.
Reproduction Steps
1. Implement a session confirm prompt per example https://idletimer.dev/docs/features/confirm-prompt
2. Observe that although `isPrompted` function is provided by the idle-timer library, it's not used and wouldn't be useful.
3. Observe that additional state must be implemented as boilerplate in order to have a state that represents the prompted state.
...
Relevant log output
No response
Screenshots or Additional Context
No response
Module Version
5.7.2
What browsers are you seeing the problem on? Select all that apply.
No response
What devices are you seeing the problem on?
No response
Verification
- I have checked for existing closed issues and discussions.