A platform for community discussion. Free, open, simple.
FIX: ReFix the loading loop when a topic is removed. (#36410)
small-lovely-cat6a4230ce90a2
diff --git a/frontend/discourse/app/models/post-stream.js b/frontend/discourse/app/models/post-stream.jsindex f86e234ebd7..7109d19d233 100644--- a/frontend/discourse/app/models/post-stream.js+++ b/frontend/discourse/app/models/post-stream.js@@ -1138,21 +1138,29 @@ export default class PostStream extends RestModel {return ajax(`/t/${this.topic.id}/posts.json`, {data,headers,- }).then((result) => {- this._setSuggestedTopics(result);- if (result.user_badges) {- this.topic.user_badges ??= {};- Object.assign(this.topic.user_badges, result.user_badges);- }+ })+ .then((result) => {+ this._setSuggestedTopics(result);+ if (result.user_badges) {+ this.topic.user_badges ??= {};+ Object.assign(this.topic.user_badges, result.user_badges);+ }- const posts = get(result, "post_stream.posts");+ const posts = get(result, "post_stream.posts");- if (posts) {- posts.forEach((p) =>- this.storePost(this.store.createRecord("post", p))- );- }- });+ if (posts) {+ posts.forEach((p) =>+ this.storePost(this.store.createRecord("post", p))+ );+ }+ })+ .catch((error) => {+ // If we get a 403 error, refresh the window to prevent continuous retries+ if (error.jqXHR && error.jqXHR.status === 403) {+ window.location.reload();+ return;+ }+ });}backfillExcerpts(streamPosition) {