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

@shopify/react-graphql

Package Overview
Dependencies
Maintainers
19
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/react-graphql - npm Package Compare versions

Comparing version 0.0.0-snapshot-20220623162708 to 0.0.0-snapshot-20220629200129

50

build/cjs/hooks/query.js

@@ -7,2 +7,3 @@ 'use strict';

var apolloClient$1 = require('apollo-client');
var isEqual = require('fast-deep-equal');
var reactEffect = require('@shopify/react-effect');

@@ -12,3 +13,12 @@ var apolloClient = require('./apollo-client.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
/* eslint react-hooks/rules-of-hooks: off */
const {
prototype: {
hasOwnProperty
}
} = Object;
function useQuery(queryOrAsyncQuery, ...optionsPart) {

@@ -76,2 +86,3 @@ const [options = {}] = optionsPart;

let subscription;
let previousError;

@@ -84,17 +95,36 @@ const invalidateCurrentResult = () => {

function invalidateErrorResult() {
unsubscribe();
function invalidateErrorResult(error) {
const lastError = queryObservable.getLastError();
const lastResult = queryObservable.getLastResult();
queryObservable.resetLastResults();
subscribe();
Object.assign(queryObservable, {
lastError,
lastResult
});
invalidateCurrentResult();
unsubscribe();
try {
queryObservable === null || queryObservable === void 0 ? void 0 : queryObservable.resetLastResults();
subscribe();
} finally {
Object.assign(queryObservable, {
lastError,
lastResult
});
}
if (!hasOwnProperty.call(error, 'graphQLErrors')) {
// The error is not a GraphQL error
throw error;
}
if (!previousError || !isEqual__default["default"](error, previousError)) {
invalidateCurrentResult();
}
previousError = error;
}
function subscribe() {
subscription = queryObservable.subscribe(invalidateCurrentResult, invalidateErrorResult);
subscription = queryObservable.subscribe(() => {
previousError = undefined;
invalidateCurrentResult();
}, error => {
invalidateErrorResult(error);
});
}

@@ -101,0 +131,0 @@

{
"name": "@shopify/react-graphql",
"version": "0.0.0-snapshot-20220623162708",
"version": "0.0.0-snapshot-20220629200129",
"license": "MIT",

@@ -38,3 +38,4 @@ "description": "Tools for creating type-safe and asynchronous GraphQL components for React",

"apollo-link": ">=1.0.0 <2.0.0",
"graphql-typed": "^2.0.0"
"graphql-typed": "^2.0.0",
"fast-deep-equal": "^3.1.3"
},

@@ -41,0 +42,0 @@ "devDependencies": {

build/esm/hooks/query.mjs

Sorry, the diff of this file is not supported yet

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