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

react-apollo

Package Overview
Dependencies
Maintainers
8
Versions
220
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-apollo - npm Package Compare versions

Comparing version 2.1.8 to 2.1.9

2

ApolloProvider.js

@@ -19,3 +19,3 @@ var __extends = (this && this.__extends) || (function () {

_this.operations = new Map();
invariant(props.client, 'ApolloClient was not passed a client instance. Make ' +
invariant(props.client, 'ApolloProvider was not passed a client instance. Make ' +
'sure you pass in your client via the "client" prop.');

@@ -22,0 +22,0 @@ if (!props.client.__operations_cache__) {

@@ -30,3 +30,5 @@ import * as React from 'react';

var instance_1 = new Comp(props, context);
instance_1.props = instance_1.props || props;
Object.defineProperty(instance_1, 'props', {
value: instance_1.props || props,
});
instance_1.context = instance_1.context || context;

@@ -46,2 +48,5 @@ instance_1.state = instance_1.state || null;

}
else if (instance_1.UNSAFE_componentWillMount) {
instance_1.UNSAFE_componentWillMount();
}
else if (instance_1.componentWillMount) {

@@ -48,0 +53,0 @@ instance_1.componentWillMount();

{
"name": "react-apollo",
"version": "2.1.8",
"version": "2.1.9",
"author": "opensource@apollographql.com",

@@ -5,0 +5,0 @@ "browser": "react-apollo.browser.umd.js",

@@ -45,2 +45,4 @@ import * as React from 'react';

context?: Record<string, any>;
onCompleted?: (data: TData | {}) => void;
onError?: (error: ApolloError) => void;
}

@@ -63,2 +65,4 @@ export interface QueryContext {

notifyOnNetworkStatusChange: PropTypes.Requireable<any>;
onCompleted: PropTypes.Requireable<any>;
onError: PropTypes.Requireable<any>;
pollInterval: PropTypes.Requireable<any>;

@@ -65,0 +69,0 @@ query: PropTypes.Validator<any>;

@@ -87,2 +87,13 @@ var __extends = (this && this.__extends) || (function () {

_this.updateCurrentData = function () {
var _a = _this.props, onCompleted = _a.onCompleted, onError = _a.onError;
if (onCompleted || onError) {
var currentResult = _this.queryObservable.currentResult();
var loading = currentResult.loading, error = currentResult.error, data = currentResult.data;
if (onCompleted && !loading && !error) {
onCompleted(data);
}
else if (onError && !loading && error) {
onError(error);
}
}
if (_this.hasMounted)

@@ -137,3 +148,3 @@ _this.forceUpdate();

return false;
var _a = this.props, children = _a.children, ssr = _a.ssr, displayName = _a.displayName, skip = _a.skip, client = _a.client, opts = __rest(_a, ["children", "ssr", "displayName", "skip", "client"]);
var _a = this.props, children = _a.children, ssr = _a.ssr, displayName = _a.displayName, skip = _a.skip, client = _a.client, onCompleted = _a.onCompleted, onError = _a.onError, opts = __rest(_a, ["children", "ssr", "displayName", "skip", "client", "onCompleted", "onError"]);
var fetchPolicy = opts.fetchPolicy;

@@ -247,2 +258,4 @@ if (ssr === false)

notifyOnNetworkStatusChange: PropTypes.bool,
onCompleted: PropTypes.func,
onError: PropTypes.func,
pollInterval: PropTypes.number,

@@ -249,0 +262,0 @@ query: PropTypes.object.isRequired,

@@ -35,3 +35,5 @@ (function (global, factory) {

var instance_1 = new Comp(props, context);
instance_1.props = instance_1.props || props;
Object.defineProperty(instance_1, 'props', {
value: instance_1.props || props,
});
instance_1.context = instance_1.context || context;

@@ -51,2 +53,5 @@ instance_1.state = instance_1.state || null;

}
else if (instance_1.UNSAFE_componentWillMount) {
instance_1.UNSAFE_componentWillMount();
}
else if (instance_1.componentWillMount) {

@@ -188,3 +193,3 @@ instance_1.componentWillMount();

_this.operations = new Map();
invariant$1(props.client, 'ApolloClient was not passed a client instance. Make ' +
invariant$1(props.client, 'ApolloProvider was not passed a client instance. Make ' +
'sure you pass in your client via the "client" prop.');

@@ -344,2 +349,13 @@ if (!props.client.__operations_cache__) {

_this.updateCurrentData = function () {
var _a = _this.props, onCompleted = _a.onCompleted, onError = _a.onError;
if (onCompleted || onError) {
var currentResult = _this.queryObservable.currentResult();
var loading = currentResult.loading, error = currentResult.error, data = currentResult.data;
if (onCompleted && !loading && !error) {
onCompleted(data);
}
else if (onError && !loading && error) {
onError(error);
}
}
if (_this.hasMounted)

@@ -394,3 +410,3 @@ _this.forceUpdate();

return false;
var _a = this.props, children = _a.children, ssr = _a.ssr, displayName = _a.displayName, skip = _a.skip, client = _a.client, opts = __rest(_a, ["children", "ssr", "displayName", "skip", "client"]);
var _a = this.props, children = _a.children, ssr = _a.ssr, displayName = _a.displayName, skip = _a.skip, client = _a.client, onCompleted = _a.onCompleted, onError = _a.onError, opts = __rest(_a, ["children", "ssr", "displayName", "skip", "client", "onCompleted", "onError"]);
var fetchPolicy = opts.fetchPolicy;

@@ -504,2 +520,4 @@ if (ssr === false)

notifyOnNetworkStatusChange: PropTypes.bool,
onCompleted: PropTypes.func,
onError: PropTypes.func,
pollInterval: PropTypes.number,

@@ -506,0 +524,0 @@ query: PropTypes.object.isRequired,

@@ -35,3 +35,5 @@ (function (global, factory) {

var instance_1 = new Comp(props, context);
instance_1.props = instance_1.props || props;
Object.defineProperty(instance_1, 'props', {
value: instance_1.props || props,
});
instance_1.context = instance_1.context || context;

@@ -51,2 +53,5 @@ instance_1.state = instance_1.state || null;

}
else if (instance_1.UNSAFE_componentWillMount) {
instance_1.UNSAFE_componentWillMount();
}
else if (instance_1.componentWillMount) {

@@ -188,3 +193,3 @@ instance_1.componentWillMount();

_this.operations = new Map();
invariant$1(props.client, 'ApolloClient was not passed a client instance. Make ' +
invariant$1(props.client, 'ApolloProvider was not passed a client instance. Make ' +
'sure you pass in your client via the "client" prop.');

@@ -344,2 +349,13 @@ if (!props.client.__operations_cache__) {

_this.updateCurrentData = function () {
var _a = _this.props, onCompleted = _a.onCompleted, onError = _a.onError;
if (onCompleted || onError) {
var currentResult = _this.queryObservable.currentResult();
var loading = currentResult.loading, error = currentResult.error, data = currentResult.data;
if (onCompleted && !loading && !error) {
onCompleted(data);
}
else if (onError && !loading && error) {
onError(error);
}
}
if (_this.hasMounted)

@@ -394,3 +410,3 @@ _this.forceUpdate();

return false;
var _a = this.props, children = _a.children, ssr = _a.ssr, displayName = _a.displayName, skip = _a.skip, client = _a.client, opts = __rest(_a, ["children", "ssr", "displayName", "skip", "client"]);
var _a = this.props, children = _a.children, ssr = _a.ssr, displayName = _a.displayName, skip = _a.skip, client = _a.client, onCompleted = _a.onCompleted, onError = _a.onError, opts = __rest(_a, ["children", "ssr", "displayName", "skip", "client", "onCompleted", "onError"]);
var fetchPolicy = opts.fetchPolicy;

@@ -504,2 +520,4 @@ if (ssr === false)

notifyOnNetworkStatusChange: PropTypes.bool,
onCompleted: PropTypes.func,
onError: PropTypes.func,
pollInterval: PropTypes.number,

@@ -506,0 +524,0 @@ query: PropTypes.object.isRequired,

import * as React from 'react';
import ApolloClient from 'apollo-client';
import { DefaultOptions } from 'apollo-client/ApolloClient';
import { MockedResponse } from './test-links';
export * from './test-links';
export declare class MockedProvider extends React.Component<any, any> {
static defaultProps: {
addTypename: boolean;
};
private client;
constructor(props: any, context: any);
export interface MockedProviderProps {
mocks?: MockedResponse[];
addTypename?: boolean;
defaultOptions?: DefaultOptions;
}
export interface MockedProviderState {
client: ApolloClient<any>;
}
export declare class MockedProvider extends React.Component<MockedProviderProps, MockedProviderState> {
static defaultProps: MockedProviderProps;
constructor(props: MockedProviderProps);
render(): JSX.Element;
componentWillUnmount(): void;
}

@@ -37,3 +37,3 @@ (function (global, factory) {

_this.operations = new Map();
invariant$1(props.client, 'ApolloClient was not passed a client instance. Make ' +
invariant$1(props.client, 'ApolloProvider was not passed a client instance. Make ' +
'sure you pass in your client via the "client" prop.');

@@ -193,2 +193,13 @@ if (!props.client.__operations_cache__) {

_this.updateCurrentData = function () {
var _a = _this.props, onCompleted = _a.onCompleted, onError = _a.onError;
if (onCompleted || onError) {
var currentResult = _this.queryObservable.currentResult();
var loading = currentResult.loading, error = currentResult.error, data = currentResult.data;
if (onCompleted && !loading && !error) {
onCompleted(data);
}
else if (onError && !loading && error) {
onError(error);
}
}
if (_this.hasMounted)

@@ -243,3 +254,3 @@ _this.forceUpdate();

return false;
var _a = this.props, children = _a.children, ssr = _a.ssr, displayName = _a.displayName, skip = _a.skip, client = _a.client, opts = __rest(_a, ["children", "ssr", "displayName", "skip", "client"]);
var _a = this.props, children = _a.children, ssr = _a.ssr, displayName = _a.displayName, skip = _a.skip, client = _a.client, onCompleted = _a.onCompleted, onError = _a.onError, opts = __rest(_a, ["children", "ssr", "displayName", "skip", "client", "onCompleted", "onError"]);
var fetchPolicy = opts.fetchPolicy;

@@ -353,2 +364,4 @@ if (ssr === false)

notifyOnNetworkStatusChange: PropTypes.bool,
onCompleted: PropTypes.func,
onError: PropTypes.func,
pollInterval: PropTypes.number,

@@ -918,15 +931,25 @@ query: PropTypes.object.isRequired,

__extends$a(MockedProvider, _super);
function MockedProvider(props, context) {
var _this = _super.call(this, props, context) || this;
var link = new MockLink(_this.props.mocks, _this.props.addTypename);
_this.client = new ApolloClient__default({
link: link,
cache: new apolloCacheInmemory.InMemoryCache({ addTypename: _this.props.addTypename }),
defaultOptions: _this.props.defaultOptions,
function MockedProvider(props) {
var _this = _super.call(this, props) || this;
var _a = _this.props, mocks = _a.mocks, addTypename = _a.addTypename, defaultOptions = _a.defaultOptions;
var client = new ApolloClient__default({
cache: new apolloCacheInmemory.InMemoryCache({ addTypename: addTypename }),
defaultOptions: defaultOptions,
link: new MockLink(mocks || [], addTypename),
});
_this.state = { client: client };
return _this;
}
MockedProvider.prototype.render = function () {
return React.createElement(ApolloProvider, { client: this.client }, this.props.children);
return React.createElement(ApolloProvider, { client: this.state.client }, this.props.children);
};
MockedProvider.prototype.componentWillUnmount = function () {
var scheduler = this.state.client.queryManager.scheduler;
Object.keys(scheduler.registeredQueries).forEach(function (queryId) {
scheduler.stopPollingQuery(queryId);
});
Object.keys(scheduler.intervalQueries).forEach(function (interval) {
scheduler.fetchQueriesOnInterval(interval);
});
};
MockedProvider.defaultProps = {

@@ -933,0 +956,0 @@ addTypename: true,

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

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