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/components/Widget/ThematicsList/ThematicsList.tsx | 6 +----- src/components/Widget/TopicsList/TopicsList.tsx | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) (limited to 'src/components') 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
{t`Failed to load.`}
; if (!data) return
{t`Loading...`}
; - 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 ? (
  • 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
    {t`Failed to load.`}
    ; if (!data) return
    {t`Loading...`}
    ; - 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 ? (
  • -- cgit v1.2.3