aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/Widget/ThematicsList/ThematicsList.tsx6
-rw-r--r--src/components/Widget/TopicsList/TopicsList.tsx6
-rw-r--r--src/services/graphql/queries.ts9
3 files changed, 9 insertions, 12 deletions
diff --git a/src/components/Widget/ThematicsList/ThematicsList.tsx b/src/components/Widget/ThematicsList/ThematicsList.tsx
index f120978..d17dbd1 100644
--- a/src/components/Widget/ThematicsList/ThematicsList.tsx
+++ b/src/components/Widget/ThematicsList/ThematicsList.tsx
@@ -17,11 +17,7 @@ const ThematicsList = ({ title }: { title: string }) => {
if (error) return <div>{t`Failed to load.`}</div>;
if (!data) return <div>{t`Loading...`}</div>;
- const sortedThematics = [...data].sort((a, b) =>
- a.title.localeCompare(b.title)
- );
-
- const thematics = sortedThematics.map((thematic) => {
+ const thematics = data.map((thematic) => {
return currentThematicSlug !== thematic.slug ? (
<li key={thematic.databaseId}>
<Link href={`/thematique/${thematic.slug}`}>
diff --git a/src/components/Widget/TopicsList/TopicsList.tsx b/src/components/Widget/TopicsList/TopicsList.tsx
index 6ddb186..50205d7 100644
--- a/src/components/Widget/TopicsList/TopicsList.tsx
+++ b/src/components/Widget/TopicsList/TopicsList.tsx
@@ -17,11 +17,7 @@ const TopicsList = ({ title }: { title: string }) => {
if (error) return <div>{t`Failed to load.`}</div>;
if (!data) return <div>{t`Loading...`}</div>;
- const sortedSubjects = [...data].sort((a, b) =>
- a.title.localeCompare(b.title)
- );
-
- const subjects = sortedSubjects.map((subject) => {
+ const subjects = data.map((subject) => {
return currentTopicSlug !== subject.slug ? (
<li key={subject.databaseId}>
<Link href={`/sujet/${subject.slug}`}>
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