mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix infinite loop for sub issues (#4550)
This commit is contained in:
parent
9013497a5a
commit
fa332a9ba7
@ -18,6 +18,7 @@ export interface ISubIssues {
|
|||||||
workspaceSlug: string;
|
workspaceSlug: string;
|
||||||
projectId: string;
|
projectId: string;
|
||||||
parentIssueId: string;
|
parentIssueId: string;
|
||||||
|
rootIssueId: string;
|
||||||
spacingLeft: number;
|
spacingLeft: number;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
handleIssueCrudState: (
|
handleIssueCrudState: (
|
||||||
@ -34,6 +35,7 @@ export const IssueListItem: React.FC<ISubIssues> = observer((props) => {
|
|||||||
workspaceSlug,
|
workspaceSlug,
|
||||||
projectId,
|
projectId,
|
||||||
parentIssueId,
|
parentIssueId,
|
||||||
|
rootIssueId,
|
||||||
issueId,
|
issueId,
|
||||||
spacingLeft = 10,
|
spacingLeft = 10,
|
||||||
disabled,
|
disabled,
|
||||||
@ -70,6 +72,10 @@ export const IssueListItem: React.FC<ISubIssues> = observer((props) => {
|
|||||||
setPeekIssue({ workspaceSlug, projectId: issue.project_id, issueId: issue.id });
|
setPeekIssue({ workspaceSlug, projectId: issue.project_id, issueId: issue.id });
|
||||||
|
|
||||||
if (!issue) return <></>;
|
if (!issue) return <></>;
|
||||||
|
|
||||||
|
// check if current issue is the root issue
|
||||||
|
const isCurrentIssueRoot = issueId === rootIssueId;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={issueId}>
|
<div key={issueId}>
|
||||||
{issue && (
|
{issue && (
|
||||||
@ -78,7 +84,8 @@ export const IssueListItem: React.FC<ISubIssues> = observer((props) => {
|
|||||||
style={{ paddingLeft: `${spacingLeft}px` }}
|
style={{ paddingLeft: `${spacingLeft}px` }}
|
||||||
>
|
>
|
||||||
<div className="h-[22px] w-[22px] flex-shrink-0">
|
<div className="h-[22px] w-[22px] flex-shrink-0">
|
||||||
{subIssueCount > 0 && (
|
{/* disable the chevron when current issue is also the root issue*/}
|
||||||
|
{subIssueCount > 0 && !isCurrentIssueRoot && (
|
||||||
<>
|
<>
|
||||||
{subIssueHelpers.preview_loader.includes(issue.id) ? (
|
{subIssueHelpers.preview_loader.includes(issue.id) ? (
|
||||||
<div className="flex h-full w-full cursor-not-allowed items-center justify-center rounded-sm bg-custom-background-80 transition-all">
|
<div className="flex h-full w-full cursor-not-allowed items-center justify-center rounded-sm bg-custom-background-80 transition-all">
|
||||||
@ -206,11 +213,13 @@ export const IssueListItem: React.FC<ISubIssues> = observer((props) => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{subIssueHelpers.issue_visibility.includes(issueId) && subIssueCount > 0 && (
|
{/* should not expand the current issue if it is also the root issue*/}
|
||||||
|
{subIssueHelpers.issue_visibility.includes(issueId) && subIssueCount > 0 && !isCurrentIssueRoot && (
|
||||||
<IssueList
|
<IssueList
|
||||||
workspaceSlug={workspaceSlug}
|
workspaceSlug={workspaceSlug}
|
||||||
projectId={issue.project_id}
|
projectId={issue.project_id}
|
||||||
parentIssueId={issue.id}
|
parentIssueId={issue.id}
|
||||||
|
rootIssueId={rootIssueId}
|
||||||
spacingLeft={spacingLeft + 22}
|
spacingLeft={spacingLeft + 22}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
handleIssueCrudState={handleIssueCrudState}
|
handleIssueCrudState={handleIssueCrudState}
|
||||||
|
@ -12,6 +12,7 @@ export interface IIssueList {
|
|||||||
workspaceSlug: string;
|
workspaceSlug: string;
|
||||||
projectId: string;
|
projectId: string;
|
||||||
parentIssueId: string;
|
parentIssueId: string;
|
||||||
|
rootIssueId: string;
|
||||||
spacingLeft: number;
|
spacingLeft: number;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
handleIssueCrudState: (
|
handleIssueCrudState: (
|
||||||
@ -27,6 +28,7 @@ export const IssueList: FC<IIssueList> = observer((props) => {
|
|||||||
workspaceSlug,
|
workspaceSlug,
|
||||||
projectId,
|
projectId,
|
||||||
parentIssueId,
|
parentIssueId,
|
||||||
|
rootIssueId,
|
||||||
spacingLeft = 10,
|
spacingLeft = 10,
|
||||||
disabled,
|
disabled,
|
||||||
handleIssueCrudState,
|
handleIssueCrudState,
|
||||||
@ -50,6 +52,7 @@ export const IssueList: FC<IIssueList> = observer((props) => {
|
|||||||
workspaceSlug={workspaceSlug}
|
workspaceSlug={workspaceSlug}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
parentIssueId={parentIssueId}
|
parentIssueId={parentIssueId}
|
||||||
|
rootIssueId={rootIssueId}
|
||||||
issueId={issueId}
|
issueId={issueId}
|
||||||
spacingLeft={spacingLeft}
|
spacingLeft={spacingLeft}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
@ -399,6 +399,7 @@ export const SubIssuesRoot: FC<ISubIssuesRoot> = observer((props) => {
|
|||||||
workspaceSlug={workspaceSlug}
|
workspaceSlug={workspaceSlug}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
parentIssueId={parentIssueId}
|
parentIssueId={parentIssueId}
|
||||||
|
rootIssueId={parentIssueId}
|
||||||
spacingLeft={10}
|
spacingLeft={10}
|
||||||
disabled={!disabled}
|
disabled={!disabled}
|
||||||
handleIssueCrudState={handleIssueCrudState}
|
handleIssueCrudState={handleIssueCrudState}
|
||||||
|
Loading…
Reference in New Issue
Block a user