Skip to content

Commit

Permalink
Step 4.5: Implement remove chat with the Collection
Browse files Browse the repository at this point in the history
  • Loading branch information
DAB0mB committed Feb 13, 2017
1 parent 2607e6a commit 11b19e3
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions client/imports/pages/chats/chats.ts
Expand Up @@ -33,11 +33,6 @@ export class ChatsPage implements OnInit {
}

removeChat(chat: Chat): void {
this.chats = this.chats.map(chatsArray => {
const chatIndex = chatsArray.indexOf(chat);
chatsArray.splice(chatIndex, 1);

return chatsArray;
});
Chats.remove({_id: chat._id}).subscribe(() => {});
}
}

1 comment on commit 11b19e3

@fgarcia78
Copy link

@fgarcia78 fgarcia78 commented on 11b19e3 May 24, 2017

Choose a reason for hiding this comment

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

There's a bug on this when all items in Chats collection are deleted: the UI isn't updated (the last item still shows after removing it), the app needs to be refreshed to show the empty list. I assume the problem could be one of the following:

  1. The Chats observable it's not notifying about it being emptied when the last item is gone.
  2. The Angular iterator (ngFor) in the view doesn't do anything when the underlying list is emptied.

How can this be fixed?

Please sign in to comment.