FIX: Redirect to homepage if no posts exist (#14951)
After permanently deleting the first post of a topic the user was sometimes stuck on the page because of an infinite loop. This problem happened more often in Firefox.
This commit is contained in:
parent
c2be7c65e8
commit
88523a6d6a
|
@ -189,7 +189,8 @@ export default createWidget("post-stream", {
|
||||||
const posts = attrs.posts || [];
|
const posts = attrs.posts || [];
|
||||||
const postArray = posts.toArray();
|
const postArray = posts.toArray();
|
||||||
const postArrayLength = postArray.length;
|
const postArrayLength = postArray.length;
|
||||||
const maxPostNumber = postArray[postArrayLength - 1].post_number;
|
const maxPostNumber =
|
||||||
|
postArrayLength > 0 ? postArray[postArrayLength - 1].post_number : 0;
|
||||||
const result = [];
|
const result = [];
|
||||||
const before = attrs.gaps && attrs.gaps.before ? attrs.gaps.before : {};
|
const before = attrs.gaps && attrs.gaps.before ? attrs.gaps.before : {};
|
||||||
const after = attrs.gaps && attrs.gaps.after ? attrs.gaps.after : {};
|
const after = attrs.gaps && attrs.gaps.after ? attrs.gaps.after : {};
|
||||||
|
|
Loading…
Reference in New Issue