Allow default uploader when using external uploaders in LiveView#3801
Open
nallwhy wants to merge 1 commit intophoenixframework:mainfrom
Open
Allow default uploader when using external uploaders in LiveView#3801nallwhy wants to merge 1 commit intophoenixframework:mainfrom
nallwhy wants to merge 1 commit intophoenixframework:mainfrom
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.
In the current implementation of Phoenix.LiveView.Upload, when you configure external: &function/2, it becomes mandatory to specify an uploader.
This makes sense in most cases, but there’s an important limitation: Once you introduce even a single external uploader, you lose the ability to fall back to the default built-in uploader.
This can be problematic when you want to mix different uploader strategies depending on the file — for instance, using a custom external uploader for images, but sticking to the built-in uploader for PDFs or other files.
I’ve patched LiveView locally to support falling back to the default uploader even when external: &function/2 is set — and it works well in my testing.
If simply returning
:defaultfor the uploader in meta seems inappropriate.https://elixirforum.com/t/allow-default-uploader-when-using-external-uploaders-in-liveview/70501