summaryrefslogtreecommitdiffstats
path: root/src/services
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-01-11 15:13:41 +0100
committerArmand Philippot <git@armandphilippot.com>2022-01-11 15:33:04 +0100
commit1a74d19cf4ad080e822e84472288c701ce001e60 (patch)
tree83cb29cb510b52eacc90d84380eaf0f4d0d212ff /src/services
parentcb317554f8665bf1ce6aa18d02b12d19b0008269 (diff)
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.
Diffstat (limited to 'src/services')
-rw-r--r--src/services/graphql/queries.ts9
1 files changed, 7 insertions, 2 deletions
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<Slug[]> => {
};
export const getAllSubjects = async (): Promise<SubjectPreview[]> => {
+ // 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<Slug[]> => {
};
export const getAllThematics = async (): Promise<ThematicPreview[]> => {
+ // 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