summaryrefslogtreecommitdiffstats
path: root/src/components/organisms/layout/posts-list.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/organisms/layout/posts-list.tsx')
-rw-r--r--src/components/organisms/layout/posts-list.tsx4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/components/organisms/layout/posts-list.tsx b/src/components/organisms/layout/posts-list.tsx
index 50192dd..608130e 100644
--- a/src/components/organisms/layout/posts-list.tsx
+++ b/src/components/organisms/layout/posts-list.tsx
@@ -100,6 +100,8 @@ const PostsList: FC<PostsListProps> = ({
const isMounted = useIsMounted(listRef);
const { blog } = useSettings();
+ const lastPostId = posts.length ? posts[posts.length - 1].id : 0;
+
/**
* Retrieve the list of posts.
*
@@ -111,8 +113,6 @@ const PostsList: FC<PostsListProps> = ({
allPosts: Post[],
headingLevel: HeadingLevel = 2
): JSX.Element => {
- const lastPostId = allPosts[allPosts.length - 1].id;
-
return (
<ol className={styles.list} ref={listRef}>
{allPosts.map(({ id, ...post }) => (