Fix bug where changing the issue title would reset the body

This commit is contained in:
Rūdolfs Ošiņš
2024-02-20 14:48:33 +00:00
parent dbfb56f37b
commit 6ff0d52165
+10 -5
View File
@@ -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"}
<TextInput
placeholder="Title"
bind:value={issue.title}
bind:value={newTitle}
showKeyHint={false} />
{:else if !issue.title}
<span class="txt-missing">No title</span>
@@ -494,7 +497,7 @@
<InlineMarkdown
stripEmphasizedStyling
fontSize="large"
content={issue.title} />
content={newTitle} />
</div>
{/if}
</div>
@@ -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";
}