the-collab-lab / tcl-23-smart-shopping-list

1 stars 2 forks source link

7. As a user, I want to see a welcoming prompt to add my first item if my list is empty to help me get oriented to how the app works. #8

Closed stacietaylorcima closed 3 years ago

stacietaylorcima commented 3 years ago

AC:

yenly commented 3 years ago

As discussed in our weekly sync, this issue would also handle saving the user token to Firestore. Example use case:

  1. I create a new list. I haven't added any items yet.
  2. I give that token to my friend to join and add items.
  3. When my friend comes to the app and entered the token, it should display a list view with no items.
zeeatwork commented 3 years ago

As discussed in our weekly sync, this issue would also handle saving the user token to Firestore. Example use case:

  1. I create a new list. I haven't added any items yet.
  2. I give that token to my friend to join and add items.
  3. When my friend comes to the app and entered the token, it should display a list view with no items.

Jessica and I worked on our our PR today and realized that the use case stated above makes it impossible to pass our Acceptance Criteria for the week.

Jessica and I have discussed all options with Skyler via Zoom this evening. We think it makes sense to honor the original AC. Our current PR creates a sharable token in Firebase with a dummy item, but can quickly be refactored to conditionally keep our first item prompt without the dummy item.

yenly commented 3 years ago

From my understanding of testing the PRs from last week, the timing of when the token is saved to the database will cause an error for the use case I suggested.

When a user creates a new token:

  1. it saves to state and local storage, not to Firestore
  2. token is only saved to Firestore when they add their first item

But if they don't add an item and share their token with a friend, that friend will always get an error when trying to access the empty list.

For the original AC, your listItems is defined in App.js as an empty array as its default value (line 13). If you pass that down to List.js, then you can do the conditional to render your prompt when the list is empty. Currently, you have listItems defined twice in App. js and in List.js.

@laurenyz had recommended passing listItems down to List.js in last week's PR but I think it got lost in the conversation due to merges/refactoring.

Screen Shot 2021-04-27 at 8 25 20 AM
jssckbl commented 3 years ago

I do recall now when laurenyz made that suggestion, and I apologize it got lost in the mix! I clicked resolve and should not have.

The general idea of timing being important as to whether something works or not makes sense.

The two things I am stuck on at the moment are:

  1. I am trying to understand is where listItems is at in List.js. There is a listItem though.

  2. The research that Zenzi and I did regarding Firestore kept saying that it is not possible to start a collection without a document in it. Which in general, doesn't make sense, but that's how I am interpreting the following:

Understand Cloud Firestore

cloudFirestore

I believe the most recent conclusion Zenzi and I came to is that we are either misinterpreting what this is saying, or we need to restructure the database by including sub-documents, since it seems that a collection can exist with nothing in the documents, but something in the sub-documents.

yenly commented 3 years ago

There is an option of creating a new collection called tokenList to keep a list of all tokens to check against. This wouldn't require refactoring and restructuring the current shopping list data. The benefit of NoSQL is the ability to create all kinds of collections with different data structures.

Screen Shot 2021-04-28 at 3 55 32 PM