From 9f27b34e9e46328e4d5e8fa00b2c3ef919e8becf Mon Sep 17 00:00:00 2001 From: developomp Date: Tue, 22 Jun 2021 22:34:40 +0900 Subject: [PATCH] fixed pageList loading taking too long --- source/generate.ts | 5 +++++ source/src/pages/PostList.tsx | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/generate.ts b/source/generate.ts index 0a80068..87792b8 100644 --- a/source/generate.ts +++ b/source/generate.ts @@ -107,6 +107,11 @@ function recursiveParser(fileOrFolderPath: string) { result.posts[urlPath] = parsedMarkdown.data + // preview + // might cut mid html tag + result.posts[urlPath].preview = + parsedMarkdown.content.split(" ").slice(0, 20).join(" ") + " ..." + // date if (!result.posts[urlPath].date) { throw Error(`Date does not exist in file: ${urlPath}`) diff --git a/source/src/pages/PostList.tsx b/source/src/pages/PostList.tsx index 01c0dfe..8e041d6 100644 --- a/source/src/pages/PostList.tsx +++ b/source/src/pages/PostList.tsx @@ -87,7 +87,6 @@ export default class PostList extends React.Component< for (const postPath in posts.posts) { if (this.state.isLimited && howMany <= 0) continue - const data = await import(`../data/posts${postPath}.json`) const post = posts.posts[postPath] @@ -105,10 +104,7 @@ export default class PostList extends React.Component<