pejrich
So the setup is a PostLive that renders a bunch of posts, as well as a form, but the form is it’s own LiveComponent rendered like: <%= live_component @socket, MyAppWeb.PostFormComponent, id: :post_form %>. The actual handle_event for the post form, is handled in PostLive, not PostFormComponent
I have the socket = allow_upload(socket, :file, ...) code in both the PostLive mount function, and the PostFormComponent mount function. The form displays correctly, but something seems to happen when the form gets submitted where the ref ids get changed around. Here’s the error I get:
** (KeyError) key "phx-Fkoosv06ZyDQXSrD" not found in: %{"phx-Fkoosvzak-DQXSqj" => :file}
:erlang.map_get("phx-Fkoosv06ZyDQXSrD", %{"phx-Fkoosvzak-DQXSqj" => :file})
(phoenix_live_view 0.15.0) lib/phoenix_live_view/upload.ex:166: Phoenix.LiveView.Upload.get_upload_by_ref!/2
(phoenix_live_view 0.15.0) lib/phoenix_live_view/channel.ex:949: anonymous fn/3 in Phoenix.LiveView.Channel.maybe_update_uploads/2
(stdlib 3.13) maps.erl:233: :maps.fold_1/3
(phoenix_live_view 0.15.0) lib/phoenix_live_view/channel.ex:200: Phoenix.LiveView.Channel.handle_info/2
Is there something else I need to do when rendering a form from a component that submits to a live_view?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Marked As Solved- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
pejrich
Nevermind. I ended up figuring it up. I removed my
allow_upload/3call from the component, and added anupdate/2call like this:That got it working! Loving the new LiveView uploader!
Also Liked
bigbassroller
There was some gaps in the documentation with regards to using with phx-modal that comes with the CLI. For me was having mount on index enable allow_uploads, then chaining down to the form through the modal options. I made a demo repo to help others and undoubtedly myself in the future:
https://github.com/bigbassroller/live-view-file-uploads-example