From 2de7c11c355a1617f96c640d3800ece65987dbee Mon Sep 17 00:00:00 2001 From: Maxwell Mwandigha Date: Wed, 28 Aug 2024 15:07:03 +0300 Subject: [PATCH] Fix for edited posts being pushed at the bottom --- apps/web-mzima-client/src/app/feed/feed.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/web-mzima-client/src/app/feed/feed.component.ts b/apps/web-mzima-client/src/app/feed/feed.component.ts index af54ec4ae..4d06e31f5 100644 --- a/apps/web-mzima-client/src/app/feed/feed.component.ts +++ b/apps/web-mzima-client/src/app/feed/feed.component.ts @@ -442,7 +442,11 @@ export class FeedComponent extends MainViewComponent implements OnInit, OnDestro } public updateMasonry(): void { - this.masonry?.layout(); + console.log('Updating masonry layout'); + if (this.masonry) { + this.masonry.reloadItems(); + this.masonry?.layout(); + } } public masonryUpdateOnModeSwitch({ userEvent }: { userEvent: UserEvent }): void { @@ -868,6 +872,7 @@ export class FeedComponent extends MainViewComponent implements OnInit, OnDestro refreshPost({ id }: PostResult) { this.postsService.getById(id).subscribe((p) => { const updatedPost = _.cloneDeep(p); + console.log(updatedPost); this.posts = this.posts.map((obj) => (obj.id === updatedPost.id ? updatedPost : obj)); }); }