react-hooks-library
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -5,2 +5,3 @@ import * as tslib_1 from "tslib"; | ||
import { usePrevious } from './usePrevious'; | ||
import { useCancellablePromise } from './useCancellablePromise'; | ||
export function useQuery(props) { | ||
@@ -14,2 +15,3 @@ var _this = this; | ||
var _a = useState(mergedProps.initialData), data = _a[0], setData = _a[1]; | ||
var cancellablePromise = useCancellablePromise().cancellablePromise; | ||
var _b = useState(undefined), error = _b[0], setError = _b[1]; | ||
@@ -49,3 +51,3 @@ var _c = useState(false), loading = _c[0], setLoading = _c[1]; | ||
_a.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, mergedProps.query(variable)]; | ||
return [4 /*yield*/, cancellablePromise(mergedProps.query(variable))]; | ||
case 2: | ||
@@ -52,0 +54,0 @@ response = _a.sent(); |
{ | ||
"name": "react-hooks-library", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -5,2 +5,3 @@ import { useState, useEffect } from 'react' | ||
import { usePrevious } from './usePrevious' | ||
import { useCancellablePromise } from './useCancellablePromise' | ||
@@ -28,2 +29,3 @@ export interface IQueryProps<P> { | ||
) | ||
const { cancellablePromise } = useCancellablePromise() | ||
const [error, setError] = useState<any>(undefined) | ||
@@ -60,3 +62,3 @@ const [loading, setLoading] = useState(false) | ||
try { | ||
const response = await mergedProps.query(variable) | ||
const response = await cancellablePromise(mergedProps.query(variable)) | ||
@@ -63,0 +65,0 @@ if (response) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Possible typosquat attack
Supply chain riskThere is a package with a similar name that is downloaded much more often.
Did you mean |
---|
react-hooks-testing-library |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
308642
87
2183
0