Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WEB-915] fix: issue description mutation issue in peek overview sub-issue navigation #4157

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 25 additions & 17 deletions web/components/issues/peek-overview/issue-detail.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, useEffect } from "react";
import { FC, useEffect, useState } from "react";
import { observer } from "mobx-react";
// store hooks
import { TIssueOperations } from "@/components/issues";
Expand Down Expand Up @@ -30,6 +30,8 @@ export const PeekOverviewIssueDetails: FC<IPeekOverviewIssueDetails> = observer(
} = useIssueDetail();
// hooks
const { setShowAlert } = useReloadConfirmations(isSubmitting === "submitting");
// state
const [issueDescription, setIssueDescription] = useState<string | undefined>(undefined);

useEffect(() => {
if (isSubmitting === "submitted") {
Expand All @@ -47,12 +49,16 @@ export const PeekOverviewIssueDetails: FC<IPeekOverviewIssueDetails> = observer(

const projectDetails = getProjectById(issue?.project_id);

const issueDescription =
issue.description_html !== undefined || issue.description_html !== null
? issue.description_html != ""
? issue.description_html
: "<p></p>"
: undefined;
useEffect(() => {
setIssueDescription(
issue.description_html !== undefined || issue.description_html !== null
? issue.description_html != ""
? issue.description_html
: "<p></p>"
: undefined
);
return () => setIssueDescription(undefined);
}, [issue.description_html]);

return (
<div className="space-y-2">
Expand All @@ -70,16 +76,18 @@ export const PeekOverviewIssueDetails: FC<IPeekOverviewIssueDetails> = observer(
value={issue.name}
/>

<IssueDescriptionInput
workspaceSlug={workspaceSlug}
projectId={issue.project_id}
issueId={issue.id}
value={issueDescription}
initialValue={issueDescription}
disabled={disabled}
issueOperations={issueOperations}
setIsSubmitting={(value) => setIsSubmitting(value)}
/>
{issue?.description_html === issueDescription && (
<IssueDescriptionInput
workspaceSlug={workspaceSlug}
projectId={issue.project_id}
issueId={issue.id}
value={issueDescription}
initialValue={issueDescription}
disabled={disabled}
issueOperations={issueOperations}
setIsSubmitting={(value) => setIsSubmitting(value)}
/>
)}

{currentUser && (
<IssueReaction
Expand Down
Loading