Refactor: Fetch documents from Firestore for cross-device visibility#1
Open
Tejas3545 wants to merge 1 commit into
Open
Refactor: Fetch documents from Firestore for cross-device visibility#1Tejas3545 wants to merge 1 commit into
Tejas3545 wants to merge 1 commit into
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 documentsfrom the "articles" collection in Firestore in real-time.
useLocalStoragefor "docuview-library" has been replaced.Document deletion now also removes the entry from Firestore.
src/app/documents/[id]/page.tsxnow fetches individual documentmetadata from Firestore server-side and passes it to the
DocumentViewcomponent.src/components/document/DocumentView.tsxhas been updated toreceive 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-distpackage was downgraded to^4.0.379to resolve a build issue with the available Node.js version.