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

@expandorg/app-utils

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@expandorg/app-utils - npm Package Compare versions

Comparing version 0.0.33 to 0.0.34

7

index.js

@@ -19,3 +19,7 @@ // @flow

import { SubmitStateEffect, submitStateEffect } from './src/submitStateEffect';
import {
SubmitStateEffect,
submitStateEffect,
useSubmitEffect,
} from './src/submitStateEffect';

@@ -28,2 +32,3 @@ export {

submitStateEffect,
useSubmitEffect,
initialRequestState,

@@ -30,0 +35,0 @@ handleAsyncCall,

6

package.json
{
"name": "@expandorg/app-utils",
"version": "0.0.33",
"version": "0.0.34",
"description": "App utils",

@@ -18,6 +18,6 @@ "main": "index.js",

"dependencies": {
"@expandorg/api-client": "^0.0.18",
"@expandorg/api-client": "^0.0.19",
"@expandorg/utils": "^0.0.8"
},
"gitHead": "82f6802e4405e508219a27d2401ef13511f01f73"
"gitHead": "3c71d394a203780ee66d002a1f9e3fb351c0d8df"
}
// @flow
import { Component } from 'react';
import { Component, useEffect, useRef } from 'react';
import PropTypes from 'prop-types';

@@ -85,1 +85,31 @@ import { connect } from 'react-redux';

};
function usePrevious(value) {
const ref = useRef();
useEffect(() => {
ref.current = value;
}, [value]);
return ref.current;
}
export function useSubmitEffect(
submitState: SubmitState,
complete: Function,
failed: Function
) {
const current = submitState.state;
const prev = usePrevious(current);
useEffect(() => {
if (prev === current) {
return;
}
const prevFetching = prev === RequestStates.Fetching;
if (prevFetching && current === RequestStates.Fetched) {
complete();
}
if (prevFetching && current === RequestStates.FetchError) {
failed();
}
}, [complete, failed, current, prev]);
}
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