From 6ff0d521652677d5844a67b27466ab32ed7956a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Fri, 16 Feb 2024 16:23:43 +0000 Subject: [PATCH] Fix bug where changing the issue title would reset the body --- src/views/projects/Issue.svelte | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/views/projects/Issue.svelte b/src/views/projects/Issue.svelte index 8ba4e1dcc..235b0a867 100644 --- a/src/views/projects/Issue.svelte +++ b/src/views/projects/Issue.svelte @@ -365,6 +365,9 @@ } } + let newTitle = issue.title; + let newDescription = issue.discussion[0].body; + $: uniqueEmbeds = uniqBy( issue.discussion.flatMap(comment => comment.embeds), "content", @@ -485,7 +488,7 @@ {#if issueState !== "read"} {:else if !issue.title} No title @@ -494,7 +497,7 @@ + content={newTitle} /> {/if} @@ -542,13 +545,14 @@ rawPath={rawPath(project.head)} enableAttachments embeds={parseEmbedIntoMap(issue.discussion[0].embeds)} - body={issue.discussion[0].body} + body={newDescription} submitCaption="Save" submitInProgress={issueState === "submit"} placeholder="Leave a description" on:close={() => { issueState = "read"; - void refreshIssue(); + newTitle = issue.title; + newDescription = issue.discussion[0].body; }} on:submit={async ({ detail: { comment, embeds } }) => { if (session) { @@ -556,11 +560,12 @@ issueState = "submit"; await editIssue( session.id, - issue.title, + newTitle, issue.id, comment, Array.from(embeds.values()), ); + newDescription = comment; } finally { issueState = "read"; }