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

graphql-react

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-react - npm Package Compare versions

Comparing version 1.0.0-alpha.2 to 1.0.0-alpha.3

5

changelog.md
# graphql-react changelog
## 1.0.0-alpha.3
* Support the legacy React context API, fixing [#7](https://github.com/jaydenseric/graphql-react/issues/7).
* Use [`eslint-plugin-ava`](https://npm.im/eslint-plugin-ava).
## 1.0.0-alpha.2

@@ -4,0 +9,0 @@

37

lib/preload.js

@@ -13,3 +13,11 @@ 'use strict'

function preload(element) {
var recursePreload = function recursePreload(rootElement, loadRoot) {
var recursePreload = function recursePreload(
rootElement,
rootLegacyContext,
loadRoot
) {
if (rootLegacyContext === void 0) {
rootLegacyContext = {}
}
if (loadRoot === void 0) {

@@ -21,3 +29,3 @@ loadRoot = true

var recurse = function recurse(element) {
var recurse = function recurse(element, legacyContext) {
if (!element) return

@@ -27,3 +35,3 @@

element.forEach(function(item) {
return recurse(item)
return recurse(item, legacyContext)
})

@@ -43,3 +51,6 @@ return

if (element.type.Consumer)
recurse(element.props.children(element.type.currentValue))
recurse(
element.props.children(element.type.currentValue),
legacyContext
)
else if (

@@ -50,3 +61,3 @@ element.type.prototype &&

) {
var instance = new element.type(props)
var instance = new element.type(props, legacyContext)
instance.state = instance.state || null

@@ -65,2 +76,8 @@

if (instance.componentWillMount) instance.componentWillMount()
if (instance.getChildContext)
legacyContext = (0, _objectAssign.default)(
{},
legacyContext,
instance.getChildContext()
)
if (

@@ -73,15 +90,15 @@ instance.constructor.name === 'GraphQLQuery' &&

instance.load().then(function() {
return recursePreload(element, false)
return recursePreload(element, legacyContext, false)
})
)
else recurse(instance.render())
} else recurse(element.type(props))
else recurse(instance.render(), legacyContext)
} else recurse(element.type(props), legacyContext)
} else if (element.props && element.props.children) {
if (element.type.context)
element.type.context.currentValue = element.props.value
recurse(element.props.children)
recurse(element.props.children, legacyContext)
}
}
recurse(rootElement)
recurse(rootElement, rootLegacyContext)
return Promise.all(loading)

@@ -88,0 +105,0 @@ }

{
"name": "graphql-react",
"version": "1.0.0-alpha.2",
"version": "1.0.0-alpha.3",
"description": "A lightweight GraphQL client for React.",

@@ -59,2 +59,3 @@ "license": "MIT",

"eslint": "^4.19.0",
"eslint-plugin-ava": "^4.5.1",
"eslint-plugin-prettier": "^2.5.0",

@@ -119,4 +120,8 @@ "eslint-plugin-react": "^7.7.0",

},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"plugins": ["react", "prettier"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:ava/recommended"
],
"plugins": ["react", "ava", "prettier"],
"rules": {

@@ -123,0 +128,0 @@ "require-jsdoc": "warn",

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