Summary
On a Query field returning a multitable interface (implementations spread across
tables), both @defaultOrder on the field and a user-supplied @orderBy input
compile without errors but have no effect at runtime — results always come back
in primary-key order.
type Query {
applikasjoner(
filter: ApplikasjonerFilterInput
orderBy: ApplikasjonerOrderByInput @orderBy
): [Applikasjon] @asConnection(defaultFirstValue: 100) @defaultOrder(fields: [{name: "NAVN"}])
}
input ApplikasjonerOrderByInput {
direction: OrderDirection!
orderByField: ApplikasjonerOrderByField!
}
enum ApplikasjonerOrderByField {
NAVN @order(fields: [{name: "NAVN"}])
}
Applikasjon is a multitable interface with three implementing @table types
(feide_applikasjon, maskinporten_applikasjon, maskinbruker_applikasjon);
all three tables have the NAVN column.
Version: 10.0.0-RC30
Expected behaviour
Either results ordered by NAVN (default @defaultOrder, overridable by the
orderBy input) — or, if multitable ordering is unsupported, an author-error at
generate time like the one @condition-overloads produce, so the schema author
finds out at build time rather than the client at runtime.
Actual behaviour
Codegen succeeds. At runtime orderBy: {direction: ASC, orderByField: NAVN} and
orderBy: {direction: DESC, orderByField: NAVN} return identical results in
primary-key order:
ASC: fs.sikt.no (test), FS Admin (test), Min kompetanse (test), rasbruker_7778
DESC: fs.sikt.no (test), FS Admin (test), Min kompetanse (test), rasbruker_7778
(subjekt_id -23, -22, -21, -16 — i.e. PK ascending)
(Observed via Apollo Router against the subgraph; same behaviour without the
router. Filters via @condition on the same query work correctly, so the input
reaches the generated query — only the ordering is dropped.)
Notes
- Documentation ("Sorting", "Polymorphic queries") does not state a multitable
limitation for @orderBy/@defaultOrder; the @condition section explicitly
covers multitable, which suggests ordering was simply not wired up for the
multitable code path.
- Workaround used meanwhile: client-side sorting of each fetched page (imperfect
across pagination) in fs-admin.
Summary
On a Query field returning a multitable interface (implementations spread across
tables), both
@defaultOrderon the field and a user-supplied@orderByinputcompile without errors but have no effect at runtime — results always come back
in primary-key order.
Applikasjonis a multitable interface with three implementing@tabletypes(
feide_applikasjon,maskinporten_applikasjon,maskinbruker_applikasjon);all three tables have the
NAVNcolumn.Version:
10.0.0-RC30Expected behaviour
Either results ordered by
NAVN(default@defaultOrder, overridable by theorderByinput) — or, if multitable ordering is unsupported, an author-error atgenerate time like the one
@condition-overloads produce, so the schema authorfinds out at build time rather than the client at runtime.
Actual behaviour
Codegen succeeds. At runtime
orderBy: {direction: ASC, orderByField: NAVN}andorderBy: {direction: DESC, orderByField: NAVN}return identical results inprimary-key order:
(Observed via Apollo Router against the subgraph; same behaviour without the
router. Filters via
@conditionon the same query work correctly, so the inputreaches the generated query — only the ordering is dropped.)
Notes
limitation for
@orderBy/@defaultOrder; the@conditionsection explicitlycovers multitable, which suggests ordering was simply not wired up for the
multitable code path.
across pagination) in fs-admin.