Skip to content
This repository was archived by the owner on Sep 16, 2020. It is now read-only.

Some Strange Behavior after initial setup #14

Closed
allain opened this issue Mar 31, 2018 · 15 comments
Closed

Some Strange Behavior after initial setup #14

allain opened this issue Mar 31, 2018 · 15 comments

Comments

@allain
Copy link

allain commented Mar 31, 2018

Following along with instructions when the app runs I see:

  1. Adding event causes 2 events to appear for half a second then it disappears
  2. Commenting causes 2 comments to appear (only 1 is actually created in DynamoDB), and then after 2 seconds or so the entire event screen clears out and becomes a single "Back to Events" button.
  3. Clicking on the button takes me back to the events listing but no event is displayed
  4. Clicking the browser's Refresh Button makes the event appear again.
  5. Attempting to add another comment cause the error below to be thrown:

Uncaught TypeError: Cannot read property 'comments' of undefined
at Object.props (EventComments.js:63)

If it helps I'm running npm start in node v8.9.1 and my browser is "Version 64.0.3282.167 (Official Build) Built on Ubuntu , running on LinuxMint 18.2 (64-bit)"

Thanks

@manueliglesias
Copy link
Contributor

Hi @allain

Thanks for trying this sample! Could you please check if you get the same behavior after deleting your node_modules and re install using yarn?

@allain
Copy link
Author

allain commented Apr 1, 2018

Thanks for responding.

Using yarn 1.5.1 on first run I'm getting:

./node_modules/react-apollo/react-apollo.browser.umd.js
Module not found: Can't resolve 'apollo-client' in '/home/allain/fq/aws-mobile-appsync-events-starter-react/node_modules/react-apollo'

Unfortunately after yarn add apollo-client it runs but the problems in the issue still persist.

@ozby
Copy link

ozby commented Apr 3, 2018

i am also encountering same issues

@vmtzkr
Copy link

vmtzkr commented Apr 9, 2018

I am also experiencing this problem. Would be great, if it would be fixed quickly.

@manueliglesias
Copy link
Contributor

Hey, can you guys try again with the recently added yarn.lock ?

Feel free to re-open if needed

@vmtzkr
Copy link

vmtzkr commented Apr 11, 2018

I just tried the new yarn file and some sources point to localhost. Shouldn't be right?
error An unexpected error occurred: "http://localhost:4873/aws-appsync/-/aws-appsync-1.0.12.tgz: connect ECONNREFUSED 127.0.0.1:4873".

@allain
Copy link
Author

allain commented Apr 11, 2018

same error here

@elorzafe
Copy link
Contributor

Hi @allain and @vilius-rugaitis I have updated both lock files.

Please let me know how it goes

@erezrokah
Copy link

I'm having the same issue with latest code from master (duplicates events and comments).
I had the Uncaught TypeError: Cannot read property 'comments' of undefined at Object.props (EventComments.js:63) error as well but can't reproduce at the moment.

I'm pretty new to apollo, GraphQL and the optimistic response mechanism, but shouldn't setting an id on the client (using uuid), updating the cache based on that id, then updating again based on the response from the server (which auto generates a different id) might cause the duplication?

Regarding the Uncaught TypeError: it seems like a timing issue where the data is set to an empty object for a brief moment.
If react happens to perform a render cycle while the data object is empty you get that error.
I haven't been able to figure out the reason for that yet.

@elorzafe
Copy link
Contributor

Hi @erezrokah did you use yarn or npm install?

@erezrokah
Copy link

erezrokah commented Apr 13, 2018

@elorzafe I tried both (removed node_modules before each time).
Currently using yarn install.
Also cleared the browser cache.
It is more evident once you have more than 3 events or so.

Edit:
found this:
https://stackoverflow.com/questions/49118378/apollo-mutate-calling-update-four-times-for-a-single-mutation

Maybe it can explain the duplication.

Another edit:
I have a possible fix in this branch:
https://github.com/Noless/aws-mobile-appsync-events-starter-react/tree/duplicate_events_comments_fix

I'm still testing (I still have a duplicate keys issue with the comments subscription), but it might serve as a workaround.

Another edit. Opened #16

@burmisov
Copy link

Same bug here after precisely following all the instructions
bug

@erezrokah
Copy link

@elorzafe can we get an update regarding this issue?

@kzima
Copy link

kzima commented May 9, 2018

@manueliglesias has this been fixed?

@pachomski
Copy link

@manueliglesias  has this been fixed?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants