-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add child issues to Jira extension (#15204)
* Update jira extension - added Child Issues - Initial commit * fixed errors related to fetching * removed contributor * Update jira extension - added Child Issues - removed contributor - fixed errors related to fetching - added Child Issues * fixed error on fetching child issues * fix mutate usage for epic issues on IssueChildIssues.tsx * fix mutate usage for epic issues on IssueChildIssues.tsx * using useIssues instead of local declaration * Update jira extension - fix: update UI for non-epic issues in IssueChildIssues - added child issues to jira extension - Initial commit * added missing changelog * fixed codestyle errors * Update CHANGELOG.md * Update package.json wrong github name was provided * Update package.json i guess name it supposed to be the one on the raycast account * Update jira extension - Merge branch \'contributions/merge-1731595802691143000\' - Pull contributions - removed duplicated hook call * fixed duplicates * Cleanup * Update CHANGELOG.md and optimise images --------- Co-authored-by: Per Nielsen Tikær <[email protected]> Co-authored-by: Thomas Lombart <[email protected]> Co-authored-by: raycastbot <[email protected]>
- Loading branch information
1 parent
8c7760e
commit a00d6ec
Showing
8 changed files
with
120 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { useMemo } from "react"; | ||
|
||
import { type Issue, type IssueDetail } from "../api/issues"; | ||
import useIssues, { useEpicIssues } from "../hooks/useIssues"; | ||
|
||
import StatusIssueList from "./StatusIssueList"; | ||
|
||
export default function IssueChildIssues({ issue }: { issue: Issue }) { | ||
// Only create JQL if there are subtasks | ||
const subtaskJql = useMemo(() => { | ||
if (!issue.fields.subtasks?.length) return ""; | ||
const subtaskIds = issue.fields.subtasks.map((subtask) => subtask.id); | ||
return `issue in (${subtaskIds.join(",")})`; | ||
}, [issue.fields.subtasks]); | ||
|
||
const { | ||
issues: subtasks, | ||
isLoading: isLoadingSubtasks, | ||
mutate: mutateSubtasks, | ||
} = useIssues(subtaskJql || "issue = null"); | ||
|
||
const isEpic = issue.fields.issuetype?.name === "Epic"; | ||
const { | ||
mutate: mutateEpicIssues, | ||
issues: epicIssues, | ||
isLoading: isLoadingEpicIssues, | ||
} = useEpicIssues(isEpic ? issue.id : ""); | ||
|
||
const childIssues = useMemo(() => { | ||
const allIssues = [...(subtasks || []), ...(epicIssues || [])]; | ||
// Ensure unique keys by using issue ID | ||
return allIssues | ||
.filter((issue): issue is IssueDetail => issue !== null) | ||
.map((issue) => ({ | ||
...issue, | ||
key: `${issue.key}`, | ||
})); | ||
}, [subtasks, epicIssues]); | ||
|
||
const isLoading = isLoadingSubtasks || isLoadingEpicIssues; | ||
|
||
return ( | ||
<StatusIssueList | ||
issues={childIssues} | ||
isLoading={isLoading} | ||
mutate={async (data) => { | ||
if (isEpic) { | ||
return mutateEpicIssues(data); | ||
} | ||
// For subtasks, we need to mutate the subtasks data | ||
return mutateSubtasks(data); | ||
}} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters