fix(pending posts): clean up failed post display

This commit is contained in:
Tommaso Casaburi
2026-04-30 17:39:06 +07:00
parent e6096fd989
commit 5c74a1e495
6 changed files with 45 additions and 16 deletions
@@ -397,7 +397,8 @@ describe('CommentContent', () => {
postCid: 'post-2',
state: 'failed',
});
expect(container.textContent).toContain('Failed to publish');
expect(container.textContent).not.toContain('Failed to publish');
expect(container.textContent).toContain('still pending');
expect(container.querySelector('[data-testid="loading-ellipsis"]')).toBeNull();
testState.stateString = 'Publishing';
@@ -131,6 +131,7 @@ const CommentContent = ({ comment: post, prependContent }: { comment: Comment; p
const stateString = useStateString(resolvedPost);
const hasFailedState = state === 'failed';
const failedError = getFailedCommentError(resolvedPost);
const shouldShowUnpublishedStateDetails = !cid && (!hasFailedState || Boolean(failedError));
const loadingString = (
<div className={styles.stateString}>
@@ -298,7 +299,7 @@ const CommentContent = ({ comment: post, prependContent }: { comment: Comment; p
</Tooltip>
</span>
)}
{!cid && (
{shouldShowUnpublishedStateDetails && (
<>
<br />
<br />