Repository navigation
feat: add media library file reuse - #1045
Open
aryaanpanwar50 wants to merge 1 commit into
Open
aryaanpanwar50 wants to merge 1 commit into
aryaanpanwar50 wants to merge 1 commit into
Conversation
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.
Summary
File upload fields could only upload new files; they did not provide a way to choose an existing file from the media library.
Add a media picker that lets users reuse uploaded files across records. The file remains in Storage, and each record stores its path or URL. Removing a file from a record does not delete the shared file.
The library loads assets in pages and displays previews as they become available. Files uploaded through FireCMS are registered in the media catalog.
Related to #409.
Testing
Added 9 focused tests covering selection, duplicate handling, catalog registration, preview loading, and Storage bucket resolution. All 9 passed.
Verified with the Firebase emulator that deleting one of two records referencing the same image leaves the image and the other record intact.
Manually checked the picker and image previews. The example and Media Manager type checks passed.
The complete flow has not been tested with an automated browser test.
Limitations
Files uploaded outside FireCMS or before catalog registration was added are not automatically indexed.
The library does not track every record using a file. Deleting a file from the library can break existing references.