Skip to content

Commit 1002da8

Browse files
committed
feat(plugin-grid): order a grouped grid's groups by the level's orderBy
A level naming grouping.fields[].orderBy now orders its groups by that field: the server path forwards orderBy into the header query and reads the min/max column listViewGroupOrderColumn names; the client path folds min (asc) / max (desc) from each group's rows. Nulls sort last in both directions; ties fall back to the key comparison in the same direction. Claude-Session: https://claude.ai/code/session_01Baqv5mDLFH63hvh9G4YGn5 Co-authored-by: Claude <noreply@anthropic.com>
1 parent d5f4c2a commit 1002da8

4 files changed

Lines changed: 504 additions & 21 deletions

File tree

‎ui/packages/plugin-grid/src/ObjectGrid.tsx‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3430,18 +3430,29 @@ export const ObjectGrid: React.FC<ObjectGridComponentProps> = ({
34303430
// [objectui#7189] The entries the SERVER groups by: the render grouping less
34313431
// any key this principal may not read (see `groupingKeyReadable`). Keyed on
34323432
// the names, so a host rebuilding `grouping` every render re-asks nothing.
3433+
// [objectstack#25786] A level's `orderBy` rides along — the header query
3434+
// compiles its `min` / `max` column from it — under the same read gate: an
3435+
// `orderBy` this principal may not read is dropped, and the level orders by
3436+
// its own key, since the header row would carry that field's value and the
3437+
// group order would disclose it.
34333438
const serverGroupingKey = serverGroupedFetch
34343439
? JSON.stringify(
34353440
usableGroupingFields(groupingForRender?.fields)
34363441
.filter((gf) => groupingKeyReadable(gf.field))
3437-
.map((gf) => [gf.field, gf.order ?? null, gf.collapsed ?? null]),
3442+
.map((gf) => [
3443+
gf.field,
3444+
gf.order ?? null,
3445+
gf.collapsed ?? null,
3446+
gf.orderBy && groupingKeyReadable(gf.orderBy) ? gf.orderBy : null,
3447+
]),
34383448
)
34393449
: '[]';
34403450
const serverGroupingFields = React.useMemo(
3441-
() => (JSON.parse(serverGroupingKey) as Array<[string, 'asc' | 'desc' | null, boolean | null]>)
3442-
.map(([field, order, collapsed]) => ({
3451+
() => (JSON.parse(serverGroupingKey) as Array<[string, 'asc' | 'desc' | null, boolean | null, string | null]>)
3452+
.map(([field, order, collapsed, orderBy]) => ({
34433453
field,
34443454
...(order ? { order } : {}),
3455+
...(orderBy !== null ? { orderBy } : {}),
34453456
...(collapsed !== null ? { collapsed } : {}),
34463457
})),
34473458
[serverGroupingKey],

0 commit comments

Comments
 (0)