Repository navigation
fix(grid): consistent sorting for columns with mixed primitive types - #173
Merged
Merged
Conversation
Blankll
force-pushed
the
fix/grid-sort-mixed-type-columns
branch
from
October 8, 2026 16:09
b388918 to
0286216
Compare
Blankll
marked this pull request as draft
October 8, 2026 16:12
Blankll
marked this pull request as ready for review
October 8, 2026 16:12
Blankll
force-pushed
the
fix/grid-sort-mixed-type-columns
branch
3 times, most recently
from
October 8, 2026 16:35
dc8da67 to
97b3338
Compare
Integrate the kind-precedence design into the #171 implementation. Per-cell kind resolution (resolveSortKind on every comparison) breaks two ways on columns holding mixed primitives — routine on SQLite: - the comparator flips kind between passes, so order is unstable - resolveSortKind inspected only the LEFT value, making compare(a,b) !== -compare(b,a) — an asymmetric comparator Kind is now resolved once per column: the declared type wins outright; without one, the highest-precedence kind present is used (number → boolean → date → string; strings are never date-sniffed). NULL ordering, non-primitive column exclusion and the coercers from #171 are unchanged.
Blankll
force-pushed
the
fix/grid-sort-mixed-type-columns
branch
from
October 8, 2026 16:42
97b3338 to
d520665
Compare
The global AGENTS.md prefers const xxx = (...) => ... declarations; the antfu preset's top-level-function rule enforced the opposite and blocked the gridSort refactor. Turn the rule off — existing function declarations stay as-is, new code follows AGENTS.md.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The #171 sorting implementation resolves the comparison kind per cell (
resolveSortKindon every comparison). On columns holding mixed primitives — routine on SQLite, whose dynamic typing mixes integers, booleans and strings in one column — this breaks two ways:resolveSortKindinspected only the left value →compare(a,b) !== -compare(b,a)→ asymmetric comparatorFix
Kind is now resolved once per column (
resolveColumnKind):integer→ numeric, …)number → boolean → date → string; strings are never date-sniffedsortRowsByStateresolves kinds per sorted column and reuses them across passesTest plan
gridSort.test.ts— 24 passed, incl. new cases: untyped number+string column sorts by one fixed kind; comparator symmetry on mixed columns; declared type wins over value kindsvue-tsc --noEmit+ eslint clean