Skip to content

Commit d2699d1

Browse files
committed
Remove Subscriptions
1 parent 4e93806 commit d2699d1

File tree

2 files changed

+3
-24
lines changed

2 files changed

+3
-24
lines changed

App.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ import {
1111
import { Button, Input, Text, ListItem } from "react-native-elements";
1212
import AWSAppSyncClient from "aws-appsync";
1313
import { Rehydrated } from "aws-appsync-react";
14-
import { ApolloProvider, Query, Mutation, Subscription } from "react-apollo";
14+
import { ApolloProvider, Query, Mutation } from "react-apollo";
1515
import uuid from "uuid/v4";
1616

1717
import CREATE_APP from "./src/mutations/CreateApp";
1818
import LIST_APPS from "./src/queries/ListApps";
19-
import NEW_APP from "./src/subscriptions/NewApp";
2019

2120
import appSyncConfig from "./AppSync";
2221

@@ -29,6 +28,7 @@ const client = new AWSAppSyncClient({
2928
}
3029
});
3130

31+
const negativeRandom = () => Math.round(Math.random() * -1000000);
3232
const Loading = () => <ActivityIndicator size="large" color="#fff" />;
3333
const Error = ({ text }) => (
3434
<Text h4 style={[styles.error, styles.centerText]}>
@@ -96,7 +96,7 @@ class App extends React.Component {
9696
__typename: "AppConnection",
9797
createApp: {
9898
__typename: "App",
99-
id: Math.round(Math.random() * -1000000),
99+
id: negativeRandom(),
100100
name,
101101
link
102102
}
@@ -154,16 +154,6 @@ class App extends React.Component {
154154
return (
155155
<React.Fragment>
156156
{data.listApps.items.map(renderLI)}
157-
<Subscription subscription={NEW_APP}>
158-
{({ loading, error, data }) => {
159-
if (loading) return null;
160-
if (error)
161-
return (
162-
<Error text="Error subscribing to new app" />
163-
);
164-
return renderLI(data.onCreateApp, 0);
165-
}}
166-
</Subscription>
167157
</React.Fragment>
168158
);
169159
}}

src/subscriptions/NewApp.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)