fix(pending post page): prevent crash and ensure redirect to "not found" on invalid URL

This commit is contained in:
plebeius
2025-06-12 17:51:08 +02:00
parent 3f2a8a3790
commit 7374465c4f
2 changed files with 2 additions and 5 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ const BoardHeader = () => {
? shortAddress.endsWith('.eth') || shortAddress.endsWith('.sol')
? shortAddress.slice(0, -4)
: shortAddress
: Plebbit.getShortAddress(subplebbitAddress))}
: subplebbitAddress && Plebbit.getShortAddress(subplebbitAddress))}
{(isOffline || isOnlineStatusLoading) && !isInAllView && !isInSubscriptionsView && !isInModView && (
<span className={styles.offlineIconWrapper}>
<Tooltip content={offlineTitle}>
+1 -4
View File
@@ -14,13 +14,10 @@ const PendingPost = () => {
const isValidAccountCommentIndex =
!accountCommentIndex ||
// Check if it's a valid positive integer
(!isNaN(parseInt(accountCommentIndex)) &&
parseInt(accountCommentIndex) >= 0 &&
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));
(accountComments?.length === 0 || parseInt(accountCommentIndex) < accountComments.length));
useEffect(() => {
if (!isValidAccountCommentIndex) {