View import_json_appsscript.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Retrieves all the rows in the active spreadsheet that contain data and logs the | |
* values for each row. | |
* For more information on using the Spreadsheet API, see | |
* https://developers.google.com/apps-script/service_spreadsheet | |
*/ | |
function readRows() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var rows = sheet.getDataRange(); | |
var numRows = rows.getNumRows(); |
View TaskDetail.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useNavigationParam } from 'react-navigation-hooks'; | |
import { graphql, usePreloadedQuery } from 'react-relay/hooks'; | |
const query = graphql` | |
query TaskDetailQuery($nodeId: ID!) { | |
task: node(id: $nodeId) { | |
... on Task { | |
title | |
} | |
} |
View environment.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RelayDefaultMissingFieldHandlers from 'relay-runtime/lib/handlers/RelayDefaultMissingFieldHandlers'; | |
import missingHandlerByRefConcreteTypeField from './missingHandlerByRefConcreteTypeField'; | |
const store = new Store(new RecordSource()); | |
const network = Network.create(fetchQuery); | |
const environment = new Environment({ | |
network, | |
store, | |
missingFieldHandlers: [ |
View MissingFieldHandlers.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const missingHandlerByRefConcreteTypeField: MissingFieldHandler = { | |
kind: 'linked', | |
handle(field, _, argValues) { | |
try { | |
const argsString = | |
field.args && field.args.length | |
? `{${field.args.map(a => `"${a.name}":"${argValues[a.name]}"`).join(',')}}` | |
: null; | |
const idValue = [field.concreteType, argsString].filter(v => !!v).join(':'); |
View relay-store.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const id = base64Encode('Event:{"eventId":1}'); | |
const key = `${id}:title`; | |
const storeRecord = { | |
[key]: "My event", | |
}; |
View result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"events": { | |
"edges": [{ | |
"node": { | |
"eventId": 1, | |
"title": "My event" | |
} | |
}] | |
} | |
} |
View ScreenBDetail.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ScreenBDetail | |
const ScreenBDetailQuery = graphql` | |
query ScreenBDetailQuery { | |
root { | |
event(id: $someId) { | |
title | |
} | |
} | |
} | |
`; |
View ScreenB.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ScreenB | |
const ScreenBQuery = graphql` | |
query ScreenBQuery { | |
root { | |
events(first: $first) { | |
edges { | |
node { | |
title | |
} | |
} |
View QueryResource.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case 'store-or-network': { | |
shouldFetch = !hasFullQuery; | |
shouldAllowRender = canPartialRender; | |
break; | |
} | |
// https://github.com/facebook/relay/blob/66e747a68b8fac474fa44b4eb441c72c72daf89e/packages/relay-experimental/QueryResource.js#L392-L395 |
View DataChecker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_traverse(node: NormalizationNode, dataID: DataID): void { | |
const status = this._mutator.getStatus(dataID); | |
if (status === UNKNOWN) { | |
this._handleMissing(); | |
} | |
if (status === EXISTENT) { | |
this._traverseSelections(node.selections, dataID); | |
} | |
} | |
NewerOlder