Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚡️ lastActiveTab state: a state to know whether this is the last active tab or not #384

Open
1 of 2 tasks
aman-godara-ria opened this issue Jan 18, 2024 · 1 comment
Assignees
Labels
enhancement A new feature or improvement to an existing feature. triage Has not been reviewed yet and should not be worked on.

Comments

@aman-godara-ria
Copy link

aman-godara-ria commented Jan 18, 2024

What problem does your feature request solve?

Currently, there is a function that can tell whether a tab is the last active tab or not whenever it is called. I want a state version of it so that components re-render automatically whenever lastActiveTab state changes.

Describe the solution you are proposing.

const { lastActiveTab, isLastActiveTab } = useIdleTimer(....);
// lastActiveTab is either true or false
// isLastActiveTab is a fn which returns true, false or null

Describe alternatives you have considered.

none

Importance

I Need It

Additional Context

  • This missing feature presents as a bug.
  • This missing feature is forcing me to consider alternatives.
@aman-godara-ria aman-godara-ria added enhancement A new feature or improvement to an existing feature. triage Has not been reviewed yet and should not be worked on. labels Jan 18, 2024
@aman-godara-ria
Copy link
Author

aman-godara-ria commented Jan 18, 2024

nevermind, I was able to create a custom hook on top of useIdleTimer using onAction & onMessage props with crossTab: true

useIdleTimer({ crossTab: true, onAction: (_, api) => { api.message() }, onMessage: ... })

Not closing this feature request, just in case if react-idle-timer's team wants to provide this feature out-of-the-box. Thanks a lot for the library btw, I really liked some of the optimization features of the library to reduce computation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or improvement to an existing feature. triage Has not been reviewed yet and should not be worked on.
Projects
None yet
Development

No branches or pull requests

2 participants