Skip to content

Commit 18c5489

Browse files
committed
Works 100% πŸŽ‰
1 parent d2699d1 commit 18c5489

File tree

3 files changed

+459
-541
lines changed

3 files changed

+459
-541
lines changed

β€ŽApp.jsβ€Ž

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const client = new AWSAppSyncClient({
2828
}
2929
});
3030

31-
const negativeRandom = () => Math.round(Math.random() * -1000000);
3231
const Loading = () => <ActivityIndicator size="large" color="#fff" />;
3332
const Error = ({ text }) => (
3433
<Text h4 style={[styles.error, styles.centerText]}>
@@ -91,20 +90,20 @@ class App extends React.Component {
9190
</Text>
9291
<View style={styles.formWrapper}>
9392
<Mutation
93+
fetchPolicy="cache-and-network"
9494
mutation={CREATE_APP}
9595
optimisticResponse={{
96-
__typename: "AppConnection",
96+
__typename: "Mutation",
9797
createApp: {
9898
__typename: "App",
99-
id: negativeRandom(),
99+
id: uuid(),
100100
name,
101101
link
102102
}
103103
}}
104104
update={(cache, { data: { createApp } }) => {
105105
const data = cache.readQuery({ query: LIST_APPS });
106-
if (typeof createApp.id === "number")
107-
data.listApps.items.push(createApp);
106+
data.listApps.items.push(createApp);
108107
cache.writeQuery({
109108
query: LIST_APPS,
110109
data

β€Žpackage.jsonβ€Ž

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
"ios": "react-native-scripts ios"
1414
},
1515
"dependencies": {
16-
"aws-appsync": "^1.0.22",
17-
"aws-appsync-react": "^1.0.13",
18-
"expo": "^27.0.2",
16+
"aws-appsync": "^1.1.4",
17+
"aws-appsync-react": "^1.0.19",
18+
"expo": "^28.0.0",
1919
"graphql-tag": "^2.9.2",
20-
"react": "16.4.0",
21-
"react-apollo": "^2.1.4",
20+
"react": "16.4.1",
21+
"react-apollo": "^2.1.8",
2222
"react-native": "0.55.4",
2323
"react-native-elements": "^1.0.0-beta5",
24-
"uuid": "^3.2.1"
24+
"uuid": "^3.3.2"
2525
}
2626
}

0 commit comments

Comments
 (0)