From 8f6610f5f22d400b0cf7e8678b9ed94ab2155250 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Thu, 3 Nov 2022 18:11:16 +0100 Subject: [PATCH] fix bullet points in GraphQL Changelog (#32310) --- components/graphql/Changelog.tsx | 65 ++++++++----------- .../graphql/overview/changelog.tsx | 22 +++++++ 2 files changed, 50 insertions(+), 37 deletions(-) diff --git a/components/graphql/Changelog.tsx b/components/graphql/Changelog.tsx index e66c18cb81..bfc10c184a 100644 --- a/components/graphql/Changelog.tsx +++ b/components/graphql/Changelog.tsx @@ -17,51 +17,42 @@ export function Changelog({ changelogItems }: Props) { const slug = slugger.slug(heading) return ( -
+

{heading}

- {item.schemaChanges && - item.schemaChanges.map((change, index) => ( - -

{change.title}

-
    - {change.changes.map((change) => ( -
  • - -
  • - ))} -
-
- ))} - {item.previewChanges && - item.previewChanges.map((change, index) => ( - -

{change.title}

-
    - {change.changes.map((change) => ( -
  • - -
  • - ))} -
-
- ))} - {item.upcomingChanges && - item.upcomingChanges.map((change, index) => ( - -

{change.title}

+ {(item.schemaChanges || []).map((change, index) => ( + +

{change.title}

+
    {change.changes.map((change) => ( -
  • - -
  • +
  • ))} - - ))} +
+
+ ))} + {(item.previewChanges || []).map((change, index) => ( + +

{change.title}

+
    + {change.changes.map((change) => ( +
  • + ))} +
+
+ ))} + {(item.upcomingChanges || []).map((change, index) => ( + +

{change.title}

+ {change.changes.map((change) => ( +
  • + ))} + + ))}
  • ) }) - return
    {changes}
    + return
    {changes}
    } diff --git a/pages/[versionId]/graphql/overview/changelog.tsx b/pages/[versionId]/graphql/overview/changelog.tsx index b8b21d6d47..84a311149b 100644 --- a/pages/[versionId]/graphql/overview/changelog.tsx +++ b/pages/[versionId]/graphql/overview/changelog.tsx @@ -44,6 +44,28 @@ export const getServerSideProps: GetServerSideProps = async (context) => // Update the existing context to include the miniTocItems from GraphQL automatedPageContext.miniTocItems.push(...changelogMiniTocItems) + // All groups in the schema have a change.changes array of strings that are + // all the HTML output from a Markdown conversion. E.g. + // `

    Field filename was added to object type IssueTemplate

    ` + // Change these to just be the inside of the

    tag. + // `Field filename was added to object type IssueTemplate` + // This makes the serialized state data smaller and it makes it possible + // to render it as... + // + //

  • Field filename was added to object type IssueTemplate
  • + // + // ...without the additional

    . + schema.forEach((item) => { + for (const group of [item.schemaChanges, item.previewChanges, item.upcomingChanges]) { + group.forEach((change) => { + change.changes = change.changes.map((html) => { + if (html.startsWith('

    ') && html.endsWith('

    ')) return html.slice(3, -4) + return html + }) + }) + } + }) + return { props: { mainContext: await getMainContext(req, res),