Skip to content

Commit 7eed145

Browse files
Refactor processOverlappingPaths to include all paths from overlapping groups instead of just the most specific ones
1 parent dae32da commit 7eed145

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

src/stack.ts

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,32 +1227,22 @@ export class Stack {
12271227
/**
12281228
* @private
12291229
* @method processOverlappingPaths
1230-
* @description Processes overlapping paths using a chained approach
1230+
* @description Processes overlapping paths by including all paths from each group
12311231
* @param {Object} pathAnalysis - Analysis result from analyzeReferencePaths
12321232
* @returns {this} - Returns stack instance
12331233
*/
12341234
private processOverlappingPaths(pathAnalysis: any): Stack {
12351235
// Start with independent paths (if any)
12361236
if (pathAnalysis.independentPaths.length > 0) {
1237-
this.q.includeSpecificReferences = pathAnalysis.independentPaths
1237+
this.q.includeSpecificReferences = [...pathAnalysis.independentPaths]
1238+
} else {
1239+
this.q.includeSpecificReferences = []
12381240
}
12391241

1240-
// Process each overlapping group by using the most specific path
1242+
// Process each overlapping group by including ALL paths from each group
12411243
pathAnalysis.overlappingGroups.forEach((group: string[]) => {
1242-
// Sort group by length (longest/most specific first)
1243-
const sortedGroup = group.sort((a, b) => b.length - a.length)
1244-
1245-
// Use the most specific path from each group
1246-
const mostSpecificPath = sortedGroup[0]
1247-
1248-
// If this is the first group and we have no independent paths,
1249-
// set the includeSpecificReferences
1250-
if (!this.q.includeSpecificReferences) {
1251-
this.q.includeSpecificReferences = [mostSpecificPath]
1252-
} else {
1253-
// Add the most specific path to existing references
1254-
this.q.includeSpecificReferences.push(mostSpecificPath)
1255-
}
1244+
// Add all paths from the group to includeSpecificReferences
1245+
this.q.includeSpecificReferences.push(...group)
12561246
})
12571247

12581248
return this

typings/stack.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ export declare class Stack {
513513
/**
514514
* @private
515515
* @method processOverlappingPaths
516-
* @description Processes overlapping paths using a chained approach
516+
* @description Processes overlapping paths by including all paths from each group
517517
* @param {Object} pathAnalysis - Analysis result from analyzeReferencePaths
518518
* @returns {this} - Returns stack instance
519519
*/

0 commit comments

Comments
 (0)