fix(pending post): page could redirect to "not found" if pending post failed

This commit is contained in:
Tom (plebeius.eth)
2025-03-12 15:55:04 +01:00
parent e4a1c12326
commit b50df69cf3
+5 -2
View File
@@ -14,10 +14,13 @@ const PendingPost = () => {
const isValidAccountCommentIndex =
!accountCommentIndex ||
// Check if it's a valid positive integer
(!isNaN(parseInt(accountCommentIndex)) &&
parseInt(accountCommentIndex) >= 0 &&
accountComments?.length > 0 &&
parseInt(accountCommentIndex) < accountComments.length);
Number.isInteger(parseFloat(accountCommentIndex)) &&
// Allow index to be at most 1 position beyond the current length
// This handles the case where a new post is being created
(accountComments?.length === 0 || parseInt(accountCommentIndex) <= accountComments.length));
useEffect(() => {
if (!isValidAccountCommentIndex) {