fix: intake issue description and navigation (#5900)
This commit is contained in:
parent
cbfcbba5d1
commit
25a410719b
4 changed files with 16 additions and 18 deletions
|
|
@ -217,11 +217,12 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (isSubmitting === "submitting") return;
|
||||||
if (!isNotificationEmbed) document.addEventListener("keydown", onKeyDown);
|
if (!isNotificationEmbed) document.addEventListener("keydown", onKeyDown);
|
||||||
return () => {
|
return () => {
|
||||||
if (!isNotificationEmbed) document.removeEventListener("keydown", onKeyDown);
|
if (!isNotificationEmbed) document.removeEventListener("keydown", onKeyDown);
|
||||||
};
|
};
|
||||||
}, [onKeyDown, isNotificationEmbed]);
|
}, [onKeyDown, isNotificationEmbed, isSubmitting]);
|
||||||
|
|
||||||
if (!inboxIssue) return null;
|
if (!inboxIssue) return null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ export const InboxIssueMainContent: React.FC<Props> = observer((props) => {
|
||||||
},
|
},
|
||||||
update: async (_workspaceSlug: string, _projectId: string, _issueId: string, data: Partial<TIssue>) => {
|
update: async (_workspaceSlug: string, _projectId: string, _issueId: string, data: Partial<TIssue>) => {
|
||||||
try {
|
try {
|
||||||
await inboxIssue.updateIssue({ ...data, id: _issueId });
|
await inboxIssue.updateIssue(data);
|
||||||
captureIssueEvent({
|
captureIssueEvent({
|
||||||
eventName: "Inbox issue updated",
|
eventName: "Inbox issue updated",
|
||||||
payload: { ...data, state: "SUCCESS", element: "Inbox" },
|
payload: { ...data, state: "SUCCESS", element: "Inbox" },
|
||||||
|
|
|
||||||
|
|
@ -59,12 +59,12 @@ export const IssueDescriptionInput: FC<IssueDescriptionInputProps> = observer((p
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleDescriptionFormSubmit = useCallback(
|
const handleDescriptionFormSubmit = useCallback(
|
||||||
async (formData: Partial<TIssue>, _issueId: string) => {
|
async (formData: Partial<TIssue>) => {
|
||||||
await issueOperations.update(workspaceSlug, projectId, _issueId, {
|
await issueOperations.update(workspaceSlug, projectId, issueId, {
|
||||||
description_html: formData.description_html ?? "<p></p>",
|
description_html: formData.description_html ?? "<p></p>",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[workspaceSlug, projectId, issueOperations]
|
[workspaceSlug, projectId, issueId, issueOperations]
|
||||||
);
|
);
|
||||||
|
|
||||||
const { getWorkspaceBySlug } = useWorkspace();
|
const { getWorkspaceBySlug } = useWorkspace();
|
||||||
|
|
@ -84,17 +84,14 @@ export const IssueDescriptionInput: FC<IssueDescriptionInputProps> = observer((p
|
||||||
});
|
});
|
||||||
}, [initialValue, issueId, reset]);
|
}, [initialValue, issueId, reset]);
|
||||||
|
|
||||||
const debouncedHandleDescriptionFormSubmit = debounce(async (data: Partial<TIssue>, _issueId: string) => {
|
// ADDING handleDescriptionFormSubmit TO DEPENDENCY ARRAY PRODUCES ADVERSE EFFECTS
|
||||||
await handleDescriptionFormSubmit(data, _issueId);
|
// TODO: Verify the exhaustive-deps warning
|
||||||
setIsSubmitting("submitted");
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, 1500);
|
|
||||||
|
|
||||||
const debouncedFormSave = useCallback(
|
const debouncedFormSave = useCallback(
|
||||||
(_issueId: string) =>
|
debounce(async () => {
|
||||||
handleSubmit((data) => {
|
handleSubmit(handleDescriptionFormSubmit)().finally(() => setIsSubmitting("submitted"));
|
||||||
debouncedHandleDescriptionFormSubmit(data, _issueId);
|
}, 1500),
|
||||||
})(),
|
[handleSubmit, issueId]
|
||||||
[debouncedHandleDescriptionFormSubmit, handleSubmit]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -116,7 +113,7 @@ export const IssueDescriptionInput: FC<IssueDescriptionInputProps> = observer((p
|
||||||
onChange={(_description: object, description_html: string) => {
|
onChange={(_description: object, description_html: string) => {
|
||||||
setIsSubmitting("submitting");
|
setIsSubmitting("submitting");
|
||||||
onChange(description_html);
|
onChange(description_html);
|
||||||
debouncedFormSave(issueId);
|
debouncedFormSave();
|
||||||
}}
|
}}
|
||||||
placeholder={
|
placeholder={
|
||||||
placeholder ? placeholder : (isFocused, value) => getDescriptionPlaceholder(isFocused, value)
|
placeholder ? placeholder : (isFocused, value) => getDescriptionPlaceholder(isFocused, value)
|
||||||
|
|
|
||||||
|
|
@ -151,12 +151,12 @@ export class InboxIssueStore implements IInboxIssueStore {
|
||||||
updateIssue = async (issue: Partial<TIssue>) => {
|
updateIssue = async (issue: Partial<TIssue>) => {
|
||||||
const inboxIssue = clone(this.issue);
|
const inboxIssue = clone(this.issue);
|
||||||
try {
|
try {
|
||||||
if (!issue.id) return;
|
if (!this.issue.id) return;
|
||||||
Object.keys(issue).forEach((key) => {
|
Object.keys(issue).forEach((key) => {
|
||||||
const issueKey = key as keyof TIssue;
|
const issueKey = key as keyof TIssue;
|
||||||
set(this.issue, issueKey, issue[issueKey]);
|
set(this.issue, issueKey, issue[issueKey]);
|
||||||
});
|
});
|
||||||
await this.inboxIssueService.updateIssue(this.workspaceSlug, this.projectId, issue.id, issue);
|
await this.inboxIssueService.updateIssue(this.workspaceSlug, this.projectId, this.issue.id, issue);
|
||||||
// fetching activity
|
// fetching activity
|
||||||
this.fetchIssueActivity();
|
this.fetchIssueActivity();
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue