Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 16, 2020. It is now read-only.

Fix duplicate events and comments #16

Open
erezrokah wants to merge 2 commits into amazon-archives:master
base: master
Choose a base branch
Loading
from Noless:duplicate_events_comments_fix
Open

Fix duplicate events and comments #16

erezrokah wants to merge 2 commits into amazon-archives:master from Noless:duplicate_events_comments_fix

Conversation

@erezrokah
Copy link

@erezrokah erezrokah commented Apr 13, 2018
edited
Loading

Fixes issue #14

Detailed explanation here:
https://stackoverflow.com/questions/49118378/apollo-mutate-calling-update-four-times-for-a-single-mutation

Mutation update event is triggered 4 times instead of 2 for each mutation causing duplication.
This can be handled by setting disableOffline: true (see here https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-react.html#offline-settings)

I've also updated the code that handled duplication since it is only required in NewComment.js and EventComments.js.

I'm not sure if there is a better way of fixing this issue using some kind of AppSync configuration while avoiding disableOffline: true.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

See here as well: awslabs/aws-mobile-appsync-sdk-js#65

sagi reacted with thumbs up emoji
@erezrokah erezrokah changed the title (削除) Duplicate events and comments fix (削除ここまで) (追記) Fix duplicate events and comments (追記ここまで) Apr 13, 2018
apiKey: appSyncConfig.apiKey,
}
},
disableOffline: true
Copy link
Author

@erezrokah erezrokah Apr 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const data = proxy.readQuery({ query });

data.listEvents.items = data.listEvents.items.filter(event => event.id !== deleteEvent.id);
const index = data.listEvents.items.findIndex(event => event.id === deleteEvent.id)
Copy link
Author

@erezrokah erezrokah Apr 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /