From 1a74d19cf4ad080e822e84472288c701ce001e60 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Tue, 11 Jan 2022 15:13:41 +0100 Subject: fix(widget): remove items limit for ThematicsList and TopicsList By default WPGraphQL gets only the 10 first items if first is not specified. So some subjects was not displayed. I also add an order by title to the query. So I no longer need to sort arrays inside components. --- src/services/graphql/queries.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/services') diff --git a/src/services/graphql/queries.ts b/src/services/graphql/queries.ts index f5387e5..5aaa188 100644 --- a/src/services/graphql/queries.ts +++ b/src/services/graphql/queries.ts @@ -347,9 +347,10 @@ export const getAllSubjectsSlug = async (): Promise => { }; export const getAllSubjects = async (): Promise => { + // 10 000 is an arbitrary number that I use for small websites. const query = gql` query AllSubjects { - subjects { + subjects(first: 10000, where: { orderby: { field: TITLE, order: ASC } }) { nodes { databaseId slug @@ -472,9 +473,13 @@ export const getAllThematicsSlug = async (): Promise => { }; export const getAllThematics = async (): Promise => { + // 10 000 is an arbitrary number that I use for small websites. const query = gql` query AllThematics { - thematics { + thematics( + first: 10000 + where: { orderby: { field: TITLE, order: ASC } } + ) { nodes { databaseId slug -- cgit v1.2.3