From 1894af741557fdc54f0f16613f78826d4bb86067 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Sun, 14 Jan 2018 12:53:37 +0100 Subject: [PATCH 1/2] Remove unneeded file property This causes HTML to be really huge --- src/components/Site/Site.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/Site/Site.jsx b/src/components/Site/Site.jsx index 600fe112cc24..b440476a3497 100644 --- a/src/components/Site/Site.jsx +++ b/src/components/Site/Site.jsx @@ -44,7 +44,6 @@ const Site = ({ title: section.path.title, url: section.url, pages: section.pages.map(page => ({ - file: page.file, title: page.file.title, url: page.url })).sort(({ file: { attributes: a }}, { file: { attributes: b }}) => { From cf91508458dcd2c40a6f0fbd1beed6c7fd93decb Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Sun, 14 Jan 2018 13:28:23 +0100 Subject: [PATCH 2/2] move sort before select --- src/components/Site/Site.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Site/Site.jsx b/src/components/Site/Site.jsx index b440476a3497..d1221e05bea6 100644 --- a/src/components/Site/Site.jsx +++ b/src/components/Site/Site.jsx @@ -43,17 +43,17 @@ const Site = ({ .map((section) => ({ title: section.path.title, url: section.url, - pages: section.pages.map(page => ({ - title: page.file.title, - url: page.url - })).sort(({ file: { attributes: a }}, { file: { attributes: b }}) => { + pages: section.pages.slice().sort(({ file: { attributes: a }}, { file: { attributes: b }}) => { let group1 = a.group.toLowerCase(); let group2 = b.group.toLowerCase(); if (group1 < group2) return -1; if (group1 > group2) return 1; return a.sort - b.sort; - }) + }).map(page => ({ + title: page.file.title, + url: page.url + })) })) } />