New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

axios-hooks

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-hooks - npm Package Compare versions

Comparing version 2.4.1 to 2.5.0-0

12

CHANGELOG.md

@@ -5,2 +5,14 @@ # Changelog

## [2.5.0-0](https://github.com/simoneb/axios-hooks/compare/v2.4.1...v2.5.0-0) (2021-03-06)
### Features
* no config serialization ([15fe158](https://github.com/simoneb/axios-hooks/commit/15fe1588448fc58b0b5b83815cc3a12812a466a2))
### Bug Fixes
* tests ([4176d94](https://github.com/simoneb/axios-hooks/commit/4176d9489085febda797dabddb104141197a901c))
### [2.4.1](https://github.com/simoneb/axios-hooks/compare/v2.4.0...v2.4.1) (2021-03-06)

@@ -7,0 +19,0 @@

30

cjs/index.js

@@ -21,2 +21,4 @@ "use strict";

var _lite = require("dequal/lite");
var actions = {

@@ -279,11 +281,12 @@ REQUEST_START: 'REQUEST_START',

function useAxios(config, options) {
config = _react["default"].useMemo(function () {
return configToObject(config);
function useAxios(_config, _options) {
var config = _react["default"].useMemo(function () {
return configToObject(_config);
}, // eslint-disable-next-line react-hooks/exhaustive-deps
[JSON.stringify(config)]);
options = _react["default"].useMemo(function () {
return (0, _extends3["default"])({}, defaultOptions, options);
useDeepCompareMemoize(_config));
var options = _react["default"].useMemo(function () {
return (0, _extends3["default"])({}, defaultOptions, _options);
}, // eslint-disable-next-line react-hooks/exhaustive-deps
[JSON.stringify(options)]);
useDeepCompareMemoize(_options));

@@ -330,2 +333,15 @@ var cancelSourceRef = _react["default"].useRef();

}
}
function useDeepCompareMemoize(value) {
var ref = _react["default"].useRef();
var signalRef = _react["default"].useRef(0);
if (!(0, _lite.dequal)(value, ref.current)) {
ref.current = value;
signalRef.current += 1;
}
return [signalRef.current];
}

@@ -7,2 +7,3 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

import LRU from 'lru-cache';
import { dequal as deepEqual } from 'dequal/lite';
var actions = {

@@ -262,11 +263,11 @@ REQUEST_START: 'REQUEST_START',

function useAxios(config, options) {
config = React.useMemo(function () {
return configToObject(config);
function useAxios(_config, _options) {
var config = React.useMemo(function () {
return configToObject(_config);
}, // eslint-disable-next-line react-hooks/exhaustive-deps
[JSON.stringify(config)]);
options = React.useMemo(function () {
return _extends({}, defaultOptions, options);
useDeepCompareMemoize(_config));
var options = React.useMemo(function () {
return _extends({}, defaultOptions, _options);
}, // eslint-disable-next-line react-hooks/exhaustive-deps
[JSON.stringify(options)]);
useDeepCompareMemoize(_options));
var cancelSourceRef = React.useRef();

@@ -308,2 +309,14 @@

}
}
function useDeepCompareMemoize(value) {
var ref = React.useRef();
var signalRef = React.useRef(0);
if (!deepEqual(value, ref.current)) {
ref.current = value;
signalRef.current += 1;
}
return [signalRef.current];
}
{
"name": "axios-hooks",
"version": "2.4.1",
"version": "2.5.0-0",
"description": "axios-hooks",

@@ -37,2 +37,3 @@ "keywords": [

"@babel/runtime": "7.13.9",
"dequal": "2.0.2",
"lru-cache": "6.0.0"

@@ -39,0 +40,0 @@ },

import React from 'react'
import StaticAxios from 'axios'
import LRU from 'lru-cache'
import { dequal as deepEqual } from 'dequal/lite'

@@ -200,13 +201,13 @@ const actions = {

function useAxios(config, options) {
config = React.useMemo(
() => configToObject(config),
function useAxios(_config, _options) {
const config = React.useMemo(
() => configToObject(_config),
// eslint-disable-next-line react-hooks/exhaustive-deps
[JSON.stringify(config)]
useDeepCompareMemoize(_config)
)
options = React.useMemo(
() => ({ ...defaultOptions, ...options }),
const options = React.useMemo(
() => ({ ...defaultOptions, ..._options }),
// eslint-disable-next-line react-hooks/exhaustive-deps
[JSON.stringify(options)]
useDeepCompareMemoize(_options)
)

@@ -271,1 +272,13 @@

}
function useDeepCompareMemoize(value) {
const ref = React.useRef()
const signalRef = React.useRef(0)
if (!deepEqual(value, ref.current)) {
ref.current = value
signalRef.current += 1
}
return [signalRef.current]
}
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