fix(github-project): group by Parent issue using the row's parent (#38212)

GitHub returns no field value for the built-in Parent issue field, so
grouping by it put every row in "No Parent issue". Group by
row.content.parentIssue (keyed by URL so multi-repo projects with the
same issue number stay separate) and order groups by issue number.

Fixes #38099
This commit is contained in:
dağhan tektepe
2026-11-05 18:09:08 -08:00
committed by GitHub
parent 5ac627732c
commit 6b9af049b4
2 changed files with 46 additions and 3 deletions
+12 -1
View File
@@ -69,6 +69,17 @@ function getFieldValueForGrouping(
field: GitHubProjectField,
orderIndex: ReadonlyMap<string, number>
): { key: string; label: string; orderHint: number; iteration: ProjectGroup['iteration'] } {
// GitHub returns no field value for Parent issue; the parent lives on the content (#38099).
const parent = field.dataType === 'PARENT_ISSUE' ? row.content.parentIssue : null
if (parent) {
// Key by URL: multi-repo projects can share parent issue numbers.
return {
key: parent.url,
label: `#${parent.number}`,
orderHint: parent.number,
iteration: null
}
}
const value = row.fieldValuesByFieldId[field.id]
if (!hasNonEmptyFieldValue(value)) {
return {
@@ -183,7 +194,7 @@ export function groupRowsByField(
if (groupField.kind === 'iteration' || groupField.kind === 'single-select') {
return a[1].orderHint - b[1].orderHint
}
if (groupField.dataType === 'NUMBER') {
if (groupField.dataType === 'NUMBER' || groupField.dataType === 'PARENT_ISSUE') {
return a[1].orderHint - b[1].orderHint || a[1].label.localeCompare(b[1].label)
}
return a[1].label.localeCompare(b[1].label)