Socket
Socket
Sign inDemoInstall

apollo-map-props

Package Overview
Dependencies
Maintainers
7
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-map-props - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

11

build/withQuery.js

@@ -25,3 +25,3 @@ 'use strict';

var DEFAULT_FETCH_POLICY = 'cache-and-network';
var config = { fetchPolicy: 'cache-and-network' };

@@ -40,3 +40,3 @@ function getDisplayName(mapProps) {

_reactApollo.Query,
(0, _extends3.default)({ fetchPolicy: DEFAULT_FETCH_POLICY }, mapProps(props)),
(0, _extends3.default)({ fetchPolicy: config.fetchPolicy }, mapProps(props)),
function (result) {

@@ -52,2 +52,7 @@ var mappedProps = mapResultToProps(result, props);

};
}
}
withQuery.setConfig = function (newConfig) {
config = (0, _extends3.default)({}, config, newConfig);
console.log("config", config);
};
{
"name": "apollo-map-props",
"version": "1.2.0",
"version": "1.3.0",
"description": "To help with props mapping when using apollo with React",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -9,2 +9,11 @@ # apollo-map-props

## Configuration
The default fetchPolicy for withQuery is `cache-and-network`.
Add below code to `index.js` for changing default fetchPolicy or adding other configs.
```javascript
import { withQuery } from 'apollo-map-props';
withQuery.setConfig({ fetchPolicy: 'network-only' })
```
## Usage

@@ -11,0 +20,0 @@

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

const DEFAULT_FETCH_POLICY = 'cache-and-network';
let config = { fetchPolicy: 'cache-and-network' };

@@ -18,3 +18,3 @@ function getDisplayName(mapProps) {

const component = props => (
<Query fetchPolicy={DEFAULT_FETCH_POLICY} {...mapProps(props)}>
<Query fetchPolicy={config.fetchPolicy} {...mapProps(props)}>
{result => {

@@ -31,1 +31,5 @@ const mappedProps = mapResultToProps(result, props);

}
withQuery.setConfig = newConfig => {
config = { ...config, ...newConfig };
}
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