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

🐞 Types error maybe? #372

Open
1 task done
danielturus opened this issue Oct 12, 2023 · 0 comments
Open
1 task done

🐞 Types error maybe? #372

danielturus opened this issue Oct 12, 2023 · 0 comments
Assignees
Labels
bug A verified and reproducible bug. triage Has not been reviewed yet and should not be worked on.

Comments

@danielturus
Copy link

What happened?

Hello!

There are a few methods that return null instead of boolean as shown below and I am a bit confused. For example the method below isLastActiveTab it's written that will return boolean but it returns null and boolean.|
Could you please explain a little bit the reasoning behind this?

Thanks!

For a bit of context, I am using this method to log a user out on a single tab to avoid errors when multiple tabs attempt to execute the logout request after the first one has completed.

  /**
   * Returns whether this is the last active tab.
   */
  const isLastActiveTab = useCallback<() => boolean>((): boolean => {
    if (!manager.current) return null
    return manager.current.isLastActive
  }, [manager])

Reproduction Steps

See code below

https://github.com/SupremeTechnopriest/react-idle-timer/blob/master/src/useIdleTimer.tsx#L659

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.

Chrome

What devices are you seeing the problem on?

Desktop

Verification

  • I have checked for existing closed issues and discussions.
@danielturus danielturus added bug A verified and reproducible bug. triage Has not been reviewed yet and should not be worked on. labels Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A verified and reproducible bug. triage Has not been reviewed yet and should not be worked on.
Projects
None yet
Development

No branches or pull requests

2 participants