From 89b8e9a17b788bc9c7c4265c20247af115eabf3d Mon Sep 17 00:00:00 2001 From: Brandon Oxendine Date: Mon, 13 Apr 2026 20:39:38 +0200 Subject: [PATCH] Always show discussion comment form --- src/components/Discussion.svelte | 93 ++++++++++++-------------------- 1 file changed, 35 insertions(+), 58 deletions(-) diff --git a/src/components/Discussion.svelte b/src/components/Discussion.svelte index ac0089e00..e1dc8935b 100644 --- a/src/components/Discussion.svelte +++ b/src/components/Discussion.svelte @@ -6,13 +6,11 @@ import partial from "lodash/partial"; import sum from "lodash/sum"; - import { tick } from "svelte"; import * as roles from "@app/lib/roles"; - import { scrollIntoView } from "@app/lib/utils"; import Button from "@app/components/Button.svelte"; - import CommentToggleInput from "@app/components/CommentToggleInput.svelte"; + import ExtendedTextarea from "@app/components/ExtendedTextarea.svelte"; import Icon from "@app/components/Icon.svelte"; import ThreadComponent from "@app/components/Thread.svelte"; @@ -52,34 +50,23 @@ }: Props = $props(); /* eslint-enable prefer-const */ + let previousCobId = cobId; + let focusReply: boolean = $state(false); + let commentFormKey = $state(0); + + let hideDiscussion = $state(false); + $effect(() => { // eslint-disable-next-line @typescript-eslint/no-unused-expressions cobId; - hideDiscussion = commentThreads.length === 0; - focusReply = false; - topLevelReplyOpen = false; - }); - - let focusReply: boolean = $state(false); - let topLevelReplyOpen = $state(false); - - let hideDiscussion = $state(commentThreads.length === 0); - - async function toggleReply() { - topLevelReplyOpen = !topLevelReplyOpen; - if (!topLevelReplyOpen) { - return; + if (cobId !== previousCobId) { + previousCobId = cobId; + hideDiscussion = false; + focusReply = false; + commentFormKey += 1; } - - await tick(); - scrollIntoView(`reply-${cobId}`, { - behavior: "smooth", - block: "center", - }); - await tick(); - focusReply = true; - } + });