Skip to content

feat(useToggle): ignore react events passed to state setter #867

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

Merged
merged 2 commits into from
Jul 4, 2022

Conversation

xobotyi
Copy link
Contributor

@xobotyi xobotyi commented Jul 3, 2022

BREAKING CHANGE: useToggle now ignores react events passed to its
state setter, so it can be used as event handler directly.

Checklist

  • Have you read contribution guideline?
  • Does the code have comments in hard-to-understand areas?
  • Is there an existing issue for this PR?
  • Have the files been linted and formatted?
  • Have the docs been updated?
  • Have the tests been added to cover new hook?
  • Have you run the tests locally to confirm they pass?

fix #861

BREAKING CHANGE: `useToggle` now ignores react events passed to its
state setter, so it can be used as event handler directly.
@xobotyi xobotyi added the ✨ enhancement New feature or request label Jul 3, 2022
@xobotyi xobotyi requested a review from JoeDuncko July 3, 2022 20:04
@xobotyi xobotyi self-assigned this Jul 3, 2022
@codecov
Copy link

codecov bot commented Jul 3, 2022

Codecov Report

Merging #867 (c74843f) into master (bb6464b) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #867   +/-   ##
=======================================
  Coverage   99.89%   99.89%           
=======================================
  Files          58       58           
  Lines         991      994    +3     
  Branches      177      179    +2     
=======================================
+ Hits          990      993    +3     
  Partials        1        1           
Impacted Files Coverage Δ
src/useToggle/useToggle.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d9c4c6d...c74843f. Read the comment docs.

@xobotyi xobotyi merged commit 085f711 into master Jul 4, 2022
@xobotyi xobotyi deleted the implement-861 branch July 4, 2022 05:58
github-actions bot pushed a commit that referenced this pull request Jul 4, 2022
# [15.0.0](v14.7.1...v15.0.0) (2022-07-04)

### Bug Fixes

* **useMediaQuery:** fix state stuck for concurrent mode ([#866](#866)) ([75db2b5](75db2b5)), closes [#849](#849)

### Features

* implement `useControlledRerenderState` hook ([#865](#865)) ([ea4545b](ea4545b))
* **useToggle:** ignore react events passed to state setter ([#867](#867)) ([085f711](085f711)), closes [#861](#861)

### BREAKING CHANGES

* **useToggle:** `useToggle` now ignores react events passed to its
state setter, so it can be used as event handler directly.
* **useMediaQuery:** `useMediaQuery` and `useScreenOrientation` are
asynchronous now and yields `undefined` at very first render, but
updates to actual value right after.
@xobotyi
Copy link
Contributor Author

xobotyi commented Jul 4, 2022

🎉 This PR is included in version 15.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request released
Development

Successfully merging this pull request may close these issues.

Should hook useToggle ignore React events?
1 participant