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

use-http

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-http - npm Package Compare versions

Comparing version 0.3.3 to 0.3.4

5

dist/useFetch.js

@@ -220,2 +220,3 @@ "use strict";

}
// TODO: need [request] in dependency array. Causing infinite loop though.
// eslint-disable-next-line react-hooks/exhaustive-deps

@@ -225,3 +226,5 @@ }, dependencies);

// This can happen if a request's promise resolves after component unmounts
react_1.useEffect(function () { return request.abort; }, [request.abort]);
// TODO: should have [request.abort] in dependency array. Causing every request to be aborted though...
// eslint-disable-next-line react-hooks/exhaustive-deps
react_1.useEffect(function () { return request.abort; }, []);
return Object.assign([request, response, loading, error.current], __assign({ request: request, response: response }, request));

@@ -228,0 +231,0 @@ }

9

package.json
{
"name": "use-http",
"version": "0.3.3",
"version": "0.3.4",
"homepage": "http://use-http.com",

@@ -22,4 +22,4 @@ "main": "dist/index.js",

"@types/fetch-mock": "^7.2.3",
"@types/jest": "^24.0.12",
"@types/node": "^12.0.10",
"@types/jest": "^25.1.0",
"@types/node": "^13.1.0",
"@types/react": "^16.9.23",

@@ -34,2 +34,3 @@ "@types/react-dom": "^16.8.4",

"eslint-plugin-jest": "23.2.0",
"eslint-plugin-jest-formatting": "^1.2.0",
"eslint-plugin-jsx-a11y": "^6.2.1",

@@ -48,3 +49,3 @@ "eslint-plugin-node": "^11.0.0",

"react-test-renderer": "^16.8.6",
"ts-jest": "^24.0.0",
"ts-jest": "^25.1.0",
"typescript": "^3.4.5",

@@ -51,0 +52,0 @@ "utility-types": "^3.10.0",

@@ -825,4 +825,13 @@ <a href="http://use-http.com">

const request = useFetch({
onSuccess: (/* idk what to put here */) => {},
onError: (error) => {},
// enabled React Suspense mode
suspense: false,
// allows caching to persist after page refresh
persist: true, // false by default
// Allows you to pass in your own cache to useFetch
// This is controversial though because `cache` is an option in the requestInit
// and it's value is a string. See: https://developer.mozilla.org/en-US/docs/Web/API/Request/cache
// One possible solution is to move the default `fetch`'s `cache` to `cachePolicy`.
// I don't really like this solution though.
// Another solution is to only allow the `cache` option with the `<Provider cache={new Map()} />`
cache: new Map(),
// can retry on certain http status codes

@@ -849,2 +858,4 @@ retryOn: [503],

onServer: true,
onSuccess: (/* idk what to put here */) => {},
onError: (error) => {},
// if you would prefer to pass the query in the config

@@ -854,4 +865,2 @@ query: `some graphql query`

mutation: `some graphql mutation`
// enabled React Suspense mode
suspense: false,
retryOnError: false,

@@ -865,3 +874,2 @@ refreshWhenHidden: false,

- [retryDelay (react-query)](https://github.com/tannerlinsley/react-query)
- [zeit's swr](https://github.com/zeit/swr)

@@ -868,0 +876,0 @@ - [ ] potential option ideas for `GraphQL`

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