mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(pending post): page could redirect to "not found" if pending post failed
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user