WhatsApp-Clone-Tutorial icon indicating copy to clipboard operation
WhatsApp-Clone-Tutorial copied to clipboard

[Question] Exploring tutorial updates from previous steps

Open wtrocki opened this issue 5 years ago • 3 comments

We have a team now working on validating tutorials and if someone is the middle of the steps and entire tutorial recieves update it is hard currently to figure it out what has changed in other steps.

What is the recommendation in this case (update happens while you are in the middle of the tutorial)?

Is it possible to see what was changed in the previous steps? I know it is possible to get the most recent step source code so there is not an issue, but I'm curious if there is way to actually see all changes that happened in an update for previous steps?

wtrocki avatar Jul 18 '19 15:07 wtrocki

ping @MStokluska

wtrocki avatar Jul 18 '19 15:07 wtrocki

In step 8 in addMessage mutation last message is found by const lastMessageId = chat.messages[chat.messages.length - 1]; what it returns is the last message assigned to a chat with X chatId. However once added, when I run view chat by ID and filter through last messages the messages that has been added overlap with existing messages of same ID but from different chats. So in example

mutation addmessage{
  addMessage(chatId:"2", content:"hello"){
    content
    id
  }
}

produces:

{
  "data": {
    "addMessage": {
      "content": "hello",
      "id": "3"
    }
  }
}

But then when I execute query

query viewLastMessage{
  chat(chatId:"2"){
    messages{
      content
      id
    }
  }
}

it produces:

{
  "data": {
    "chat": {
      "messages": [
        {
          "content": "Hey, it's me",
          "id": "2"
        },
        {
          "content": "I should buy a boat",
          "id": "3"
        },
        {
          "content": "hello",
          "id": "3"
        }
      ]
    }
  }
}

2 messages of same id: 3 which isn't correct. I found that changing the lastMessageId to const lastMessageId = messages.length; fixes this issue.

Am I missing something

MStokluska avatar Jul 18 '19 16:07 MStokluska

I think there are 2 separate things here.

For the first comment, it is technically possible with the Tortilla CLI, the question is how do we want to display it on the website? (tagging @DAB0mB as well)

right now you can see diffs between whole versions at the top. Do you have an idea what would be a good way to display diffs between versions and steps? Maybe a drop down once you moved to the diff page that lets you choose a specific step for each side?

about the second comment by @MStokluska , could you open it as a separate issue or even a separate PR? I will merge it and add you as a contributor (I'm now doing the same for your server PR)

Urigo avatar Jul 20 '19 13:07 Urigo