Socket
Socket
Sign inDemoInstall

@shopify/react-hooks

Package Overview
Dependencies
Maintainers
13
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/react-hooks - npm Package Compare versions

Comparing version 1.11.0 to 1.11.1

9

CHANGELOG.md

@@ -10,4 +10,11 @@ # Changelog

## [1.20.0] - 2020-08-18
## [1.11.1] - 2020-08-19
### Fixed
- `useDelayedCallback` now uses `useRef` instead of `useState` in to avoid unnecessary re-render ([#1600](https://github.com/Shopify/quilt/pull/1600))
- Improved test case for `useDelayedCallback` ([#1601](https://github.com/Shopify/quilt/pull/1601))
## [1.11.0] - 2020-08-18
### Added

@@ -14,0 +21,0 @@

14

dist/src/hooks/delayed-callback.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var react_1 = require("react");
function useDelayedCallback(callback, delay) {
var _a = tslib_1.__read(react_1.useState(), 2), timeoutId = _a[0], setTimeoutId = _a[1];
var timeoutRef = react_1.useRef();
react_1.useEffect(function () {
return function () {
if (timeoutId != null) {
clearTimeout(timeoutId);
if (timeoutRef.current != null) {
clearTimeout(timeoutRef.current);
}
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
function callbackWithDelay() {
var callbackId = setTimeout(function () {
var timeoutId = setTimeout(function () {
callback();
setTimeoutId(undefined);
timeoutRef.current = undefined;
}, delay);
setTimeoutId(callbackId);
timeoutRef.current = timeoutId;
}

@@ -22,0 +20,0 @@ return callbackWithDelay;

{
"name": "@shopify/react-hooks",
"version": "1.11.0",
"version": "1.11.1",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "A collection of primitive React hooks",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc