Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Fix orderBy when typename is selected #607

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/translate/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,13 @@ const translateNestedOrderingArgument = ({
.reduce((temporalSubFields, t) => {
// temporal type subfields, year, minute, etc.
const subFieldName = t.name.value;

// fix for 'no such field __typename' on orderBy
// https://github.com/neo4j-graphql/neo4j-graphql-js/issues/581
if (subFieldName === '__typename') {
return temporalSubFields;
}

if (subFieldName === 'formatted') {
temporalSubFields.push(
`${subFieldName}: toString(sortedElement.${fieldName})`
Expand Down