Skip to content

Commit

Permalink
Merge pull request #140 from relay-tools/relay-v1.6.0-hack
Browse files Browse the repository at this point in the history
Fix Relay v1.6.0 compatibility
  • Loading branch information
taion authored May 24, 2018
2 parents 6323edd + 01b919c commit 76f8d3d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/modern/ReadyStateRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@ class ReadyStateRenderer extends React.Component {
};

this.selectionReference = querySubscription.retain();

this.relayContext = {};
this.updateRelayContext(querySubscription);
}

getChildContext() {
return {
relay: this.props.querySubscription.relayContext,
relay: this.relayContext,
};
}

Expand All @@ -62,6 +65,8 @@ class ReadyStateRenderer extends React.Component {

this.props.querySubscription.unsubscribe(this.onUpdate);
querySubscription.subscribe(this.onUpdate);

this.updateRelayContext(querySubscription);
}
}

Expand Down Expand Up @@ -91,6 +96,12 @@ class ReadyStateRenderer extends React.Component {
this.setState({ element: element || null });
};

updateRelayContext(querySubscription) {
// XXX: Relay v1.6.0 adds an assumption that context.relay is mutated
// in-place, so we need to do that here.
Object.assign(this.relayContext, querySubscription.relayContext);
}

render() {
const { element } = this.state;
if (!element) {
Expand Down

0 comments on commit 76f8d3d

Please sign in to comment.