Skip to content

Commit e261d5d

Browse files
fix: only show 'Hide replies' button when replies exist
Co-authored-by: Chris Bongers <rebelchris@users.noreply.github.com>
1 parent 3958adc commit e261d5d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/shared/src/components/comments/MainComment.spec.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,8 @@ it('should show creator badge', async () => {
218218
const el = await screen.findByText('Creator');
219219
expect(el).toBeInTheDocument();
220220
});
221+
222+
it('should not show hide replies button when there are no replies', async () => {
223+
renderLayout();
224+
expect(screen.queryByText('Hide replies')).not.toBeInTheDocument();
225+
});

packages/shared/src/components/comments/MainComment.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export default function MainComment({
179179
onExpand={() => setAreRepliesExpanded(true)}
180180
/>
181181
)}
182-
{inView && areRepliesExpanded && (
182+
{inView && replyCount > 0 && areRepliesExpanded && (
183183
<>
184184
<button
185185
type="button"

0 commit comments

Comments
 (0)