Skip to content
This repository was archived by the owner on May 27, 2022. It is now read-only.

Commit

Permalink
fix(usePolling): Do not modify original intervals array when checking…
Browse files Browse the repository at this point in the history
… sorting
javierbrea committed Oct 31, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 0ff3fc0 commit 2ca1629
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -18,6 +18,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed
- chore(deps): Update dependencies

### Fixed
- fix(usePolling): Do not modify original intervals array when check sorting

## [1.2.0] - 2020-06-21

### Added
2 changes: 1 addition & 1 deletion src/usePolling.js
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ class PollingHandler {
}

_checkInterval() {
const sortedIntervals = this._intervalTimes.sort((a, b) => a - b);
const sortedIntervals = [...this._intervalTimes].sort((a, b) => a - b);
if (sortedIntervals[0] !== this._currentIntervalTime) {
this._clearInterval();
this._currentIntervalTime = sortedIntervals[0];
2 changes: 1 addition & 1 deletion test/hocs.spec.js
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ describe("HOCs", () => {
});

it("should wrap displayName of the component using name property if component has not displayName", async () => {
const BooksComponent = ({ data }) => {
BooksComponent = ({ data }) => {
return <Books books={data} />;
};
BooksComponent.displayName = null;

0 comments on commit 2ca1629

Please sign in to comment.