Skip to content

Commit 8a00df9

Browse files
committed
refactor: implement defaultComparator
1 parent d0357ed commit 8a00df9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Query/Filter/Field.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,16 @@ export abstract class Field {
311311
return this.createGrouper(true);
312312
}
313313

314-
protected defaultComparator: Comparator = (_a: Task, _b: Task) => {
314+
protected defaultComparator: Comparator = (a: Task, b: Task) => {
315+
const groupA = this.grouper()(a);
316+
const groupB = this.grouper()(b);
317+
318+
for (let i = 0; i < groupA.length; i++) {
319+
// The containers are guaranteed to be identical sizes since we are calling the same grouper
320+
return groupA[i].localeCompare(groupB[i], undefined, { numeric: true });
321+
}
322+
323+
// identical if we reach here
315324
return 0;
316325
};
317326
}

0 commit comments

Comments
 (0)