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

[@mantine/hooks] use-idle: Start timer immediately instead of waiting for an event (#6682) #6683

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

chimericdream
Copy link
Contributor

This came up when I was implementing automatic logout in our application. If a given event never fires, the current implementation of useIdle will never return true.

This PR starts the timer immediately after setting up the event listeners.

Fixes #6682

@rtivital
Copy link
Member

Please fix errors in tests

@chimericdream
Copy link
Contributor Author

Fixed.

@rtivital rtivital merged commit 95115da into mantinedev:master Aug 26, 2024
1 check passed
@rtivital
Copy link
Member

Thanks!

davydkov pushed a commit to likec4/likec4 that referenced this pull request Sep 12, 2024
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@mantine/core](https://mantine.dev/)
([source](https://redirect.github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/core))
| [`^7.12.0` ->
`^7.12.2`](https://renovatebot.com/diffs/npm/@mantine%2fcore/7.12.0/7.12.2)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@mantine%2fcore/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@mantine%2fcore/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@mantine%2fcore/7.12.0/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@mantine%2fcore/7.12.0/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@mantine/hooks](https://mantine.dev)
([source](https://redirect.github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/hooks))
| [`^7.12.0` ->
`^7.12.2`](https://renovatebot.com/diffs/npm/@mantine%2fhooks/7.12.0/7.12.2)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@mantine%2fhooks/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@mantine%2fhooks/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@mantine%2fhooks/7.12.0/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@mantine%2fhooks/7.12.0/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>mantinedev/mantine (@&#8203;mantine/core)</summary>

###
[`v7.12.2`](https://redirect.github.com/mantinedev/mantine/releases/tag/7.12.2)

[Compare
Source](https://redirect.github.com/mantinedev/mantine/compare/7.12.1...7.12.2)

##### What's Changed

- `[@mantine/hooks]` use-idle: Fix idle countdown not starting if the
user did non interact with the page
([#&#8203;6683](https://redirect.github.com/mantinedev/mantine/issues/6683))
- `[@mantine/core]` ScrollArea: Fix `onBottomReached` prop not being
available in `ScrollArea.Autosize` component
- `[@mantine/core]` Remove `children` from Checkbox, Radio and Switch
types to avoid accidental errors
- `[@mantine/core]` TypographyStylesProvider: Fix incorrect table styles
in dark color scheme
- `[@mantine/form]` Fix error thrown for nullable values dirty status
check
([#&#8203;6672](https://redirect.github.com/mantinedev/mantine/issues/6672))
- `[@mantine/core]` Badge: Fix unexpected change to block layout, fix
incorrect alignment when fixed width is set
([#&#8203;6698](https://redirect.github.com/mantinedev/mantine/issues/6698),
[#&#8203;6680](https://redirect.github.com/mantinedev/mantine/issues/6680))
- `[@mantine/core]` ScrollArea: Fix pointer-events being left as `none`
after interaction with scrollbar
([#&#8203;6681](https://redirect.github.com/mantinedev/mantine/issues/6681))
- `[@mantine/core]` Tabs: Fix `keepMounted` prop being added as
attribute to `Tabs.Panel` DOM element
([#&#8203;6711](https://redirect.github.com/mantinedev/mantine/issues/6711))
- `[@mantine/core]` Tree: Add `initialCheckedState` support
([#&#8203;6697](https://redirect.github.com/mantinedev/mantine/issues/6697))
- `[@mantine/spotlight]` Fix `SpotlightRoot` component not being
exported
([#&#8203;6710](https://redirect.github.com/mantinedev/mantine/issues/6710))
- `[@mantine/dropzone]` Add `7z` and `rar` mime types exports
([#&#8203;6702](https://redirect.github.com/mantinedev/mantine/issues/6702))
- `[@mantine/dates]` DatePickerInput: Fix incorrect hovered date logic
when the component receives value update with partial selected date
range
([#&#8203;6718](https://redirect.github.com/mantinedev/mantine/issues/6718))
- `[@mantine/dates]` Fix `valueFormatter` prop being added to
DateTimePicker types
- `[@mantine/core]` Badge: Fix right/left sections height affecting the
alignment of the label
- `[@mantine/core]` Menu: Fix accessibility warning in devtools when the
Menu is opened
([#&#8203;6644](https://redirect.github.com/mantinedev/mantine/issues/6644))

##### New Contributors

- [@&#8203;timesince](https://redirect.github.com/timesince) made their
first contribution in
[mantinedev/mantine#6654
- [@&#8203;tokyojack](https://redirect.github.com/tokyojack) made their
first contribution in
[mantinedev/mantine#6718
- [@&#8203;Streusel](https://redirect.github.com/Streusel) made their
first contribution in
[mantinedev/mantine#6702
- [@&#8203;fredgig](https://redirect.github.com/fredgig) made their
first contribution in
[mantinedev/mantine#6697
- [@&#8203;chimericdream](https://redirect.github.com/chimericdream)
made their first contribution in
[mantinedev/mantine#6683
- [@&#8203;Aybrea](https://redirect.github.com/Aybrea) made their first
contribution in
[mantinedev/mantine#6724

**Full Changelog**:
mantinedev/mantine@7.12.1...7.12.2

###
[`v7.12.1`](https://redirect.github.com/mantinedev/mantine/releases/tag/7.12.1)

[Compare
Source](https://redirect.github.com/mantinedev/mantine/compare/7.12.0...7.12.1)

##### What's Changed

- `[@mantine/dates]` DateInput: Fix default date being set to the
current date when `minDate` is set to the future
([#&#8203;6646](https://redirect.github.com/mantinedev/mantine/issues/6646))
-   `[@mantine/core]` ScrollArea: Fix incorrect thumb::before styles
- `[@mantine/core]` Fix incorrect active styles of buttons used inside
disabled fieldset
- `[@mantine/form]` Fix `form.watch` callbacks not being fired when
`form.initialize` is called
([#&#8203;6639](https://redirect.github.com/mantinedev/mantine/issues/6639))
- `[@mantine/core]` Switch: Fix Switch shrinking when large label or
description is used
([#&#8203;6531](https://redirect.github.com/mantinedev/mantine/issues/6531))
- `[@mantine/core]` Combobox: Fix `Combobox.Search` overflow when
`ScrollArea` is used in the dropdown
([#&#8203;6562](https://redirect.github.com/mantinedev/mantine/issues/6562))
- `[@mantine/core]` Accordion: Add missing `withProps` function
([#&#8203;6564](https://redirect.github.com/mantinedev/mantine/issues/6564))
- `[@mantine/core]` Pill: Fix remove icon overflowing pill container if
its background color was changed with Styles API
([#&#8203;6565](https://redirect.github.com/mantinedev/mantine/issues/6565))
- `[@mantine/core]` PinInput: Allow passing props to individual input
elements depending on index with `getInputProps`
([#&#8203;6588](https://redirect.github.com/mantinedev/mantine/issues/6588))
- `[@mantine/charts]`: Fix LineChart Legend and Tooltip to support
nested names
([#&#8203;6536](https://redirect.github.com/mantinedev/mantine/issues/6536))
- `[@mantine/core]` Tooltip: Add missing `Tooltip.Group.extend` function
([#&#8203;6576](https://redirect.github.com/mantinedev/mantine/issues/6576))
- `[@mantine/spotlight]` Fix `limit` prop not working correctly with
actions groups
([#&#8203;6632](https://redirect.github.com/mantinedev/mantine/issues/6632))
- `[@mantine/core]` Badge: Fix text overflow not being handled correctly
([#&#8203;6629](https://redirect.github.com/mantinedev/mantine/issues/6629))
- `[@mantine/core]` SegmentedControl: Add `data-disabled` attribute to
the root element to simplify styling with Styles API
([#&#8203;6625](https://redirect.github.com/mantinedev/mantine/issues/6625))
- `[@mantine/core]` SegmentedControl: Fix initial position of indicator
being broken when the component is used inside other element that has
transitions on mount
([#&#8203;6622](https://redirect.github.com/mantinedev/mantine/issues/6622))
- `[@mantine/core]` TagsInput: Fix `onKeyDown` prop not working
([#&#8203;6569](https://redirect.github.com/mantinedev/mantine/issues/6569))
- `[@mantine/charts]` PieChart: Fix `valueFormatter` not working on
outside labels
([#&#8203;6616](https://redirect.github.com/mantinedev/mantine/issues/6616))
- `[@mantine/core]` Popover: Fix `apply` function of `size` middleware
not being handled correctly
([#&#8203;6598](https://redirect.github.com/mantinedev/mantine/issues/6598))
- `[@mantine/core]` Chip: Fix incorrect checked padding for `size="xl"`
([#&#8203;6586](https://redirect.github.com/mantinedev/mantine/issues/6586))
- `[@mantine/dates]` TimeInput: Fix incorrect focus styles of am/pm
input
([#&#8203;6579](https://redirect.github.com/mantinedev/mantine/issues/6579))
- `[@mantine/hook]` use-os: Fix incorrect iPadOS detection
([#&#8203;6535](https://redirect.github.com/mantinedev/mantine/issues/6535))
- `[@mantine/core]` DatePickerInput: Fix incorrect `aria-label` being
set on the input element
([#&#8203;6530](https://redirect.github.com/mantinedev/mantine/issues/6530))
- `[@mantine/core]` Menu: Fix incorrect Escape key handling inside Modal
([#&#8203;6580](https://redirect.github.com/mantinedev/mantine/issues/6580))

##### New Contributors

- [@&#8203;vorant94](https://redirect.github.com/vorant94) made their
first contribution in
[mantinedev/mantine#6530
- [@&#8203;hajimism](https://redirect.github.com/hajimism) made their
first contribution in
[mantinedev/mantine#6539
- [@&#8203;ziimakc](https://redirect.github.com/ziimakc) made their
first contribution in
[mantinedev/mantine#6561
- [@&#8203;th3fallen](https://redirect.github.com/th3fallen) made their
first contribution in
[mantinedev/mantine#6579
- [@&#8203;david-szabo97](https://redirect.github.com/david-szabo97)
made their first contribution in
[mantinedev/mantine#6586
- [@&#8203;bastiankistner](https://redirect.github.com/bastiankistner)
made their first contribution in
[mantinedev/mantine#6607
- [@&#8203;inx-fldu](https://redirect.github.com/inx-fldu) made their
first contribution in
[mantinedev/mantine#6569
- [@&#8203;michaelperros](https://redirect.github.com/michaelperros)
made their first contribution in
[mantinedev/mantine#6622
- [@&#8203;risen228](https://redirect.github.com/risen228) made their
first contribution in
[mantinedev/mantine#6625
- [@&#8203;ddoemonn](https://redirect.github.com/ddoemonn) made their
first contribution in
[mantinedev/mantine#6629
- [@&#8203;yorkeJohn](https://redirect.github.com/yorkeJohn) made their
first contribution in
[mantinedev/mantine#6632
- [@&#8203;raulfpl](https://redirect.github.com/raulfpl) made their
first contribution in
[mantinedev/mantine#6639
- [@&#8203;uriFrischman](https://redirect.github.com/uriFrischman) made
their first contribution in
[mantinedev/mantine#6645

**Full Changelog**:
mantinedev/mantine@7.12.0...7.12.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/likec4/likec4).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC43NC4xIiwidXBkYXRlZEluVmVyIjoiMzguNzQuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIl19-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useIdle doesn't start tracking until after the first event
2 participants