-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Add child issues to Jira extension #15204
Merged
Merged
Changes from 12 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
767fed5
Update jira extension
horumyy b3f6d88
fixed errors related to fetching
horumyy a851bce
removed contributor
horumyy 1c00ebb
Update jira extension
horumyy 7e5dcd9
fixed error on fetching child issues
horumyy 9cc9e31
fix mutate usage for epic issues on IssueChildIssues.tsx
horumyy 42aaab3
fix mutate usage for epic issues on IssueChildIssues.tsx
horumyy 437da2f
using useIssues instead of local declaration
horumyy 93ca4ce
Update jira extension
horumyy a543c92
added missing changelog
horumyy 8b2af40
fixed codestyle errors
horumyy 638f5b9
Update CHANGELOG.md
pernielsentikaer 82606b5
Update package.json
horumyy 432109d
Update package.json
horumyy 41235e9
Update jira extension
horumyy 1dd5a02
fixed duplicates
horumyy 4a46290
Cleanup
thomaslombart 2b56015
Update CHANGELOG.md and optimise images
raycastbot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,58 @@ | ||
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 }) { | ||
const { mutate: mutateEpicIssues } = useEpicIssues(issue?.id ?? ""); | ||
|
||
// Only create JQL if there are subtask | ||
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", // Provide valid JQL even when no subtasks | ||
); | ||
|
||
const isEpic = issue.fields.issuetype?.name === "Epic"; | ||
const { issues: epicIssues, isLoading: isLoadingEpicIssues } = useEpicIssues( | ||
isEpic ? issue.id : "", // Only fetch epic issues for epics | ||
); | ||
|
||
// Memoize the combined and filtered child issues | ||
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}`, // Ensure unique keys | ||
})); | ||
}, [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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why having two
useEpicIssues
in the component? Can't they be combined into one?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, fixed on latest commit! :)