import { registerComponent, Components, useSingle } from 'meteor/vulcan:core';
import React from 'react';
import withUser from '../common/withUser';
import Users from 'meteor/vulcan:users';
import withErrorBoundary from '../common/withErrorBoundary';

const BookmarksList = ({currentUser, limit=50 }) => {
  const { PostsItem2, Loading } = Components

  const { document: user, loading } = useSingle({
    collection: Users,
    queryName: "postLinkPreview",
    fragmentName: 'UserBookmarks',
    fetchPolicy: 'cache-then-network',
    documentId: currentUser._id,
  });

  let bookmarkedPosts = user?.bookmarkedPosts || []
  bookmarkedPosts = bookmarkedPosts.slice(0, limit)

  if (loading) return <Loading/>

  return (
    <div>
      {bookmarkedPosts.map((post) => <PostsItem2 key={post._id} post={post} bookmark/>)}
    </div>
  )
}

registerComponent('BookmarksList', BookmarksList, withUser, withErrorBoundary);

import { registerComponent, Components, useSingle } from 'meteor/vulcan:core';
import React from 'react';
import withUser from '../common/withUser';
import Users from 'meteor/vulcan:users';
import withErrorBoundary from '../common/withErrorBoundary';

const BookmarksList = ({currentUser, limit=50 }) => {
  const { PostsItem2, Loading } = Components

  const { document: user, loading } = useSingle({
    collection: Users,
    queryName: "postLinkPreview",
    fragmentName: 'UserBookmarks',
    fetchPolicy: 'cache-then-network',
    documentId: currentUser._id,
  });

  let bookmarkedPosts = user?.bookmarkedPosts || []
  bookmarkedPosts = bookmarkedPosts.reverse().slice(0, limit)

  if (loading) return <Loading/>

  return (
    <div>
      {bookmarkedPosts.map((post) => <PostsItem2 key={post._id} post={post} bookmark/>)}
    </div>
  )
}

registerComponent('BookmarksList', BookmarksList, withUser, withErrorBoundary);

Change so most recently added bookmarks display first.
Change so most recently added bookmarks display first.
