mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
Fix unresponsive search
closes #6274 - any time the search content is refreshed, start with a clean array instead of performing expensive object comparisons to remove existing content
This commit is contained in:
parent
58e32f6774
commit
677a2bfb8a
@ -37,6 +37,7 @@ export default Component.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.set('isLoading', true);
|
this.set('isLoading', true);
|
||||||
|
this.set('content', []);
|
||||||
promises.pushObject(this._loadPosts());
|
promises.pushObject(this._loadPosts());
|
||||||
promises.pushObject(this._loadUsers());
|
promises.pushObject(this._loadUsers());
|
||||||
promises.pushObject(this._loadTags());
|
promises.pushObject(this._loadTags());
|
||||||
@ -54,8 +55,6 @@ export default Component.extend({
|
|||||||
let content = this.get('content');
|
let content = this.get('content');
|
||||||
|
|
||||||
return ajax(postsUrl, {data: postsQuery}).then((posts) => {
|
return ajax(postsUrl, {data: postsQuery}).then((posts) => {
|
||||||
content.removeObjects(this.get('posts'));
|
|
||||||
content.removeObjects(this.get('pages'));
|
|
||||||
content.pushObjects(posts.posts.map((post) => {
|
content.pushObjects(posts.posts.map((post) => {
|
||||||
return {
|
return {
|
||||||
id: `post.${post.id}`,
|
id: `post.${post.id}`,
|
||||||
@ -73,7 +72,6 @@ export default Component.extend({
|
|||||||
let content = this.get('content');
|
let content = this.get('content');
|
||||||
|
|
||||||
return ajax(usersUrl, {data: usersQuery}).then((users) => {
|
return ajax(usersUrl, {data: usersQuery}).then((users) => {
|
||||||
content.removeObjects(this.get('users'));
|
|
||||||
content.pushObjects(users.users.map((user) => {
|
content.pushObjects(users.users.map((user) => {
|
||||||
return {
|
return {
|
||||||
id: `user.${user.slug}`,
|
id: `user.${user.slug}`,
|
||||||
@ -91,7 +89,6 @@ export default Component.extend({
|
|||||||
let content = this.get('content');
|
let content = this.get('content');
|
||||||
|
|
||||||
return ajax(tagsUrl, {data: tagsQuery}).then((tags) => {
|
return ajax(tagsUrl, {data: tagsQuery}).then((tags) => {
|
||||||
content.removeObjects(this.get('tags'));
|
|
||||||
content.pushObjects(tags.tags.map((tag) => {
|
content.pushObjects(tags.tags.map((tag) => {
|
||||||
return {
|
return {
|
||||||
id: `tag.${tag.slug}`,
|
id: `tag.${tag.slug}`,
|
||||||
|
Loading…
Reference in New Issue
Block a user