mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 18:43:38 +08:00
FIX: the empty state message was appearing in wrong moments on the user bookmarks stage (#14127)
Steps to reproduce: 1. Go to activity/bookmarks 2. Search for something that isn’t in your bookmarks, so you get no results 3. Navigate away and then click "Bookmarked" on the sidebar or open the user menu and click the View All Bookmarks button on the bottom of the bookmarks tab, and you get the message "You haven't bookmarked anything yet". This commit fixes the problem. We have a controller with a query parameter q that contains a search query. And we also have a property searchTerm that is bound to the search box on the page and mirrors the value in q. We were using a value from searchTerm when querying the server, but ember controllers are singletons so the searchTerm value persisted between page visits and leaded to this bug. To make things work properly, we should be using the value from q everywhere except two places when we copy a value from q to searchTerm and vice versa.
This commit is contained in:
parent
c995b20ca4
commit
4d5f5a67c1
|
@ -25,14 +25,11 @@ export default Controller.extend({
|
|||
content: [],
|
||||
loading: true,
|
||||
permissionDenied: false,
|
||||
searchTerm: this.q,
|
||||
});
|
||||
|
||||
if (this.q && !this.searchTerm) {
|
||||
this.set("searchTerm", this.q);
|
||||
}
|
||||
|
||||
return this.model
|
||||
.loadItems({ q: this.searchTerm })
|
||||
.loadItems({ q: this.q })
|
||||
.then((response) => this._processLoadResponse(response))
|
||||
.catch(() => this._bookmarksListDenied())
|
||||
.finally(() => {
|
||||
|
@ -85,7 +82,7 @@ export default Controller.extend({
|
|||
this.set("loadingMore", true);
|
||||
|
||||
return this.model
|
||||
.loadMore({ q: this.searchTerm })
|
||||
.loadMore({ q: this.q })
|
||||
.then((response) => this._processLoadResponse(response))
|
||||
.catch(() => this._bookmarksListDenied())
|
||||
.finally(() => this.set("loadingMore", false));
|
||||
|
|
Loading…
Reference in New Issue
Block a user