summaryrefslogtreecommitdiffstats
path: root/src/components/Widget/TopicsList/TopicsList.tsx
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/components/Widget/TopicsList/TopicsList.tsx
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/components/Widget/TopicsList/TopicsList.tsx')
-rw-r--r--src/components/Widget/TopicsList/TopicsList.tsx6
1 files changed, 1 insertions, 5 deletions
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}`}>