forked from github/plane
fix: updated issue description rendering when we switch between two issues via sub-issue (#4143)
This commit is contained in:
parent
c843a1757f
commit
03df410b52
@ -28,6 +28,7 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
|
|||||||
const { workspaceSlug, projectId, issueId, issueOperations, is_editable } = props;
|
const { workspaceSlug, projectId, issueId, issueOperations, is_editable } = props;
|
||||||
// states
|
// states
|
||||||
const [isSubmitting, setIsSubmitting] = useState<"submitting" | "submitted" | "saved">("saved");
|
const [isSubmitting, setIsSubmitting] = useState<"submitting" | "submitted" | "saved">("saved");
|
||||||
|
const [issueDescription, setIssueDescription] = useState<string | undefined>(undefined);
|
||||||
// hooks
|
// hooks
|
||||||
const { currentUser } = useUser();
|
const { currentUser } = useUser();
|
||||||
const { projectStates } = useProjectState();
|
const { projectStates } = useProjectState();
|
||||||
@ -52,12 +53,16 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
|
|||||||
|
|
||||||
const currentIssueState = projectStates?.find((s) => s.id === issue.state_id);
|
const currentIssueState = projectStates?.find((s) => s.id === issue.state_id);
|
||||||
|
|
||||||
const issueDescription =
|
useEffect(() => {
|
||||||
|
setIssueDescription(
|
||||||
issue.description_html !== undefined || issue.description_html !== null
|
issue.description_html !== undefined || issue.description_html !== null
|
||||||
? issue.description_html != ""
|
? issue.description_html != ""
|
||||||
? issue.description_html
|
? issue.description_html
|
||||||
: "<p></p>"
|
: "<p></p>"
|
||||||
: undefined;
|
: undefined
|
||||||
|
);
|
||||||
|
return () => setIssueDescription(undefined);
|
||||||
|
}, [issue.description_html]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -94,6 +99,7 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
|
|||||||
value={issue.name}
|
value={issue.name}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{issue?.description_html === issueDescription && (
|
||||||
<IssueDescriptionInput
|
<IssueDescriptionInput
|
||||||
workspaceSlug={workspaceSlug}
|
workspaceSlug={workspaceSlug}
|
||||||
projectId={issue.project_id}
|
projectId={issue.project_id}
|
||||||
@ -104,6 +110,7 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
|
|||||||
issueOperations={issueOperations}
|
issueOperations={issueOperations}
|
||||||
setIsSubmitting={(value) => setIsSubmitting(value)}
|
setIsSubmitting={(value) => setIsSubmitting(value)}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{currentUser && (
|
{currentUser && (
|
||||||
<IssueReaction
|
<IssueReaction
|
||||||
|
Loading…
Reference in New Issue
Block a user