-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
View Trips Page Real time Updates #96
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, the real-time feature is really nice for such a relatively small change to the code, pretty nice! FYI Chrome incognito windows might help when testing with two different accounts simultaneously.
Yeah it is super nice! I tried to use incognito windows but it did not work when trying to log in. I got this error: |
…tripArr for more clarity.
Issue earlier with error component must have been a different error that was accidentally fixed when switching to the asynchronous version of this function.
What is a quick description of the change?
Enable real time updates such that any collaborator's update to a trip (add, edit, or delete) is immediately reflected in the local view of the trip for all collaborators.
Is this fixing an issue?
fixes #62
Are there more details that are relevant?
The main addition of this PR is to the
ViewTrips
directory with the following files:trips-container.js
:get
was replaced withonSnapshot
when querying trips in order to use the real-time update features Firestore has to offer.queryuserTrips
andserveTrips
were combined and moved intocomponentDidMount
.This was done due to the constraints set byonSnapshot
: both the querySnapshot handling callback and the error callback must be passed intoonSnapshot
rather thanonSnapshot
returning a promise.index.js
,save-trip-modal.js
,trip.js
, anddelete-trip-button.js
: Remove all functions, variables, props, and references relatedrefreshTripContainer
(including TODOs to fix Implement Real Time Updates for all Trip Collaborators #62).Check lists (check
x
in[ ]
of list items)As of now, integration (end-to-end) tests were deemed non-critical. Thus, functions related to react and firestore will be tested at a later time. Unit tests were not written for this PR as there was no (original) "logical" functions written to complete this feature.
Any additional comments?
GIF showing real-time updates for a shared trip between users [email protected] and [email protected]:
Note: I could not use two chrome windows because only one user can be signed into SLURP at a time in all instances of chrome. So the left window is Firefox ESR (that is why it looks kinda gross).