Skip to content

Conversation

@Tejas3545
Copy link
Owner

Previously, your application relied heavily on localStorage for storing and retrieving document lists and details. This prevented documents uploaded by one user from being visible on other devices or by other users.

This commit refactors your application to use Firestore as the central source of truth for document metadata:

  • src/app/page.tsx (HomePage) now fetches the list of all documents
    from the "articles" collection in Firestore in real-time.
    useLocalStorage for "docuview-library" has been replaced.
    Document deletion now also removes the entry from Firestore.
  • src/app/documents/[id]/page.tsx now fetches individual document
    metadata from Firestore server-side and passes it to the
    DocumentView component.
  • src/components/document/DocumentView.tsx has been updated to
    receive document data as a prop, removing its direct localStorage-based
    fetching logic.

This change ensures that all users see the same set of documents, addressing the core issue. Uploads continue to use Cloudinary for file storage (when configured) and Firestore for metadata.

A build warning regarding Cloudinary server-side environment variables was noted and should be addressed separately to ensure full functionality of Cloudinary-dependent operations like file deletion from the cloud. The pdfjs-dist package was downgraded to ^4.0.379 to resolve a build issue with the available Node.js version.

Previously, your application relied heavily on localStorage for storing and
retrieving document lists and details. This prevented documents uploaded
by one user from being visible on other devices or by other users.

This commit refactors your application to use Firestore as the central
source of truth for document metadata:

-   `src/app/page.tsx` (HomePage) now fetches the list of all documents
    from the "articles" collection in Firestore in real-time.
    `useLocalStorage` for "docuview-library" has been replaced.
    Document deletion now also removes the entry from Firestore.
-   `src/app/documents/[id]/page.tsx` now fetches individual document
    metadata from Firestore server-side and passes it to the
    `DocumentView` component.
-   `src/components/document/DocumentView.tsx` has been updated to
    receive document data as a prop, removing its direct localStorage-based
    fetching logic.

This change ensures that all users see the same set of documents,
addressing the core issue. Uploads continue to use Cloudinary for
file storage (when configured) and Firestore for metadata.

A build warning regarding Cloudinary server-side environment variables
was noted and should be addressed separately to ensure full functionality
of Cloudinary-dependent operations like file deletion from the cloud.
The `pdfjs-dist` package was downgraded to `^4.0.379` to resolve a
build issue with the available Node.js version.
@vercel
Copy link

vercel bot commented Jun 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
article-viewer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2025 3:42pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants