Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Fix bug where changing the issue title would reset the body
Rūdolfs Ošiņš committed 2 years ago
commit 6ff0d521652677d5844a67b27466ab32ed7956a5
parent dbfb56f37b9f0511fcf890cfcb6b3192dbe808fc
1 file changed +10 -5
modified 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"}
              <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";
                  }