Skip to content

Commit addff8b

Browse files
committed
fix(fe-bookmarks-delete): when delete from bookmarks search results force page reload
Not optimal but not that of an usual use case...
1 parent 16a464a commit addff8b

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

frontend/src/app/search-results/search-results.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
[bookmarks$]="searchResults$"
3535
[queryText]="searchText"
3636
[userData$]="userData$"
37+
[isSearchResultsPage]="true"
3738
[showFilterBox]="false">
3839
</app-async-bookmark-list>
3940
</div>
@@ -71,6 +72,7 @@
7172
[bookmarks$]="searchResults$"
7273
[queryText]="searchText"
7374
[userData$]="userData$"
75+
[isSearchResultsPage]="true"
7476
[showFilterBox]="false">
7577
</app-async-bookmark-list>
7678
</ng-template>

frontend/src/app/shared/async-bookmark-list/async-bookmark-list.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
[userData$]="userData$"
1111
[queryText]="queryText"
1212
[filterText]="filterText"
13+
[isSearchResultsPage]="isSearchResultsPage"
1314
>
1415
</app-bookmark-list-element>
1516
</div>

frontend/src/app/shared/async-bookmark-list/async-bookmark-list.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ export class AsyncBookmarkListComponent extends TagFollowingBaseComponent implem
3434
@Input()
3535
showPagination = true;
3636

37+
@Input()
38+
isSearchResultsPage = false;
39+
3740
@Output()
3841
bookmarkDeleted = new EventEmitter<boolean>();
3942

frontend/src/app/shared/bookmark-list-element/bookmark-list-element.component.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ export class BookmarkListElementComponent extends TagFollowingBaseComponent impl
5151
@Input()
5252
isDetailsPage = false;
5353

54+
@Input()
55+
isSearchResultsPage = false;
56+
5457
@Input()
5558
filterText = '';
5659

@@ -77,7 +80,7 @@ export class BookmarkListElementComponent extends TagFollowingBaseComponent impl
7780
super(loginDialog, userDataWatchedTagsStore);
7881

7982
// START force reload on same root - solution taken from https://github.com/angular/angular/issues/13831
80-
this.router.routeReuseStrategy.shouldReuseRoute = function(){
83+
this.router.routeReuseStrategy.shouldReuseRoute = function () {
8184
return false;
8285
}
8386

@@ -198,16 +201,23 @@ export class BookmarkListElementComponent extends TagFollowingBaseComponent impl
198201
this.bookmarkDeleted.emit(true);
199202
this.publicBookmarksStore.removeBookmarkFromPublicStore(bookmark);
200203
this.feedStore.removeFromFeedBookmarks(bookmark);
204+
if (this.isSearchResultsPage) {
205+
location.reload();
206+
}
201207
});
202208
} else {
203209
this.personalBookmarksService.deleteBookmark(bookmark).subscribe(() => {
204-
this.bookmarkDeleted.emit(true);
205-
this.publicBookmarksStore.removeBookmarkFromPublicStore(bookmark);
206-
this.userDataStore.removeFromStoresAtDeletion(bookmark);
207-
this.myBookmarksStore.removeFromStoresAtDeletion(bookmark);
208-
this.feedStore.removeFromFeedBookmarks(bookmark);
209-
if (this.isDetailsPage) {
210-
this.navigateToHomePage();
210+
if (this.isSearchResultsPage) {
211+
location.reload();
212+
} else {
213+
this.bookmarkDeleted.emit(true);
214+
this.publicBookmarksStore.removeBookmarkFromPublicStore(bookmark);
215+
this.userDataStore.removeFromStoresAtDeletion(bookmark);
216+
this.myBookmarksStore.removeFromStoresAtDeletion(bookmark);
217+
this.feedStore.removeFromFeedBookmarks(bookmark);
218+
if (this.isDetailsPage) {
219+
this.navigateToHomePage();
220+
}
211221
}
212222
});
213223
}

0 commit comments

Comments
 (0)