Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-useasync-hooks

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-useasync-hooks - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

7

dist/cjs/lib/useTimeoutAsync.js

@@ -58,3 +58,5 @@ "use strict";

else {
reject(new Error("Callback cancelled"));
// dispatch({status: AsyncStatus.CANCELLED});
result(undefined);
// reject(new Error("Callback cancelled"));
}

@@ -67,3 +69,4 @@ }, props.current.milliseconds);

clearTimeout(currentTimeout);
dispatch({ status: AsyncStatus_1.AsyncStatus.ERROR, error: new Error("Callback cancelled") });
dispatch({ status: AsyncStatus_1.AsyncStatus.CANCELLED });
// dispatch({status: AsyncStatus.ERROR, error: new Error("Callback cancelled")} as AsyncActionError<ErrorType>);
}

@@ -70,0 +73,0 @@ else if (!cancelled.has(current)) {

@@ -55,3 +55,5 @@ import { useMemo, useReducer, useState } from "react";

else {
reject(new Error("Callback cancelled"));
// dispatch({status: AsyncStatus.CANCELLED});
result(undefined);
// reject(new Error("Callback cancelled"));
}

@@ -64,3 +66,4 @@ }, props.current.milliseconds);

clearTimeout(currentTimeout);
dispatch({ status: AsyncStatus.ERROR, error: new Error("Callback cancelled") });
dispatch({ status: AsyncStatus.CANCELLED });
// dispatch({status: AsyncStatus.ERROR, error: new Error("Callback cancelled")} as AsyncActionError<ErrorType>);
}

@@ -67,0 +70,0 @@ else if (!cancelled.has(current)) {

{
"name": "react-useasync-hooks",
"version": "1.0.3",
"version": "1.0.4",
"description": "React useasync timeout utils",

@@ -5,0 +5,0 @@ "scripts": {

@@ -69,2 +69,3 @@ /** @jest-environment jsdom */

// @ts-ignore
let cancelled

@@ -77,3 +78,6 @@ act(() => { cancelled = result.current[1]() });

expect(result.current[0]).toStrictEqual({ status :AsyncStatus.CANCELLED } as AsyncResulCancelled<boolean>);
await cancelled
await act(async () => {
// @ts-ignore
await cancelled
});
expect(result.current[0]).toStrictEqual({ status :AsyncStatus.CANCELLED } as AsyncResulCancelled<boolean>);

@@ -80,0 +84,0 @@ })

@@ -108,3 +108,5 @@ import {Reducer, useMemo, useReducer, useState} from "react";

} else {
reject(new Error("Callback cancelled"));
// dispatch({status: AsyncStatus.CANCELLED});
result(undefined as any as ValueType);
// reject(new Error("Callback cancelled"));
}

@@ -117,3 +119,4 @@ }, props.current.milliseconds);

clearTimeout(currentTimeout);
dispatch({status: AsyncStatus.ERROR, error: new Error("Callback cancelled")} as AsyncActionError<ErrorType>);
dispatch({status: AsyncStatus.CANCELLED});
// dispatch({status: AsyncStatus.ERROR, error: new Error("Callback cancelled")} as AsyncActionError<ErrorType>);
} else if (!cancelled.has(current)) {

@@ -120,0 +123,0 @@ dispatch({status: AsyncStatus.SUCCESS, value});

Sorry, the diff of this file is not supported yet

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