Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix avatar and banner uploads for the shop liveview #49

Open
sgobotta opened this issue Jan 22, 2023 · 1 comment · Fixed by #50
Open

Fix avatar and banner uploads for the shop liveview #49

sgobotta opened this issue Jan 22, 2023 · 1 comment · Fixed by #50
Labels
bug Something isn't working

Comments

@sgobotta
Copy link
Owner

Describe the bug:

A clear and concise description of what the bug is.

To Reproduce:

Steps to reproduce the behavior:

  1. Go to the shop edit form, either from the shop list liveview or the show shop liveview
  2. Choose a file for the avatar and a file for the banner
  3. Click Save
  4. An error appears in the console:
[error] GenServer #PID<0.797.0> terminating
** (stop) exited in: GenServer.call(#PID<0.820.0>, :consume_start, :infinity)
    ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
    (elixir 1.12.3) lib/gen_server.ex:1024: GenServer.call/3
    (phoenix_live_view 0.18.11) lib/phoenix_live_view/upload_channel.ex:15: Phoenix.LiveView.UploadChannel.consume/3
    (elixir 1.12.3) lib/enum.ex:1582: Enum."-map/2-lists^map/1-0-"/2
    (ex_commerce 0.1.0) lib/ex_commerce_web/live/live_form_helpers.ex:163: ExCommerceWeb.LiveFormHelpers.consume_uploads/5
    (ex_commerce 0.1.0) lib/ex_commerce_web/live/shop_live/form_component.ex:236: ExCommerceWeb.ShopLive.FormComponent.consume_media_files/2
    (ex_commerce 0.1.0) lib/ex_commerce/marketplaces.ex:164: ExCommerce.Marketplaces.after_save/2
    (ex_commerce 0.1.0) lib/ex_commerce_web/live/shop_live/form_component.ex:103: ExCommerceWeb.ShopLive.FormComponent.save_shop/3
    (phoenix_live_view 0.18.11) lib/phoenix_live_view/channel.ex:618: anonymous fn/4 in Phoenix.LiveView.Channel.inner_component_handle_event/4
    (telemetry 0.4.3) /home/sann/Documents/proyectos/ex_commerce/repos/ex_commerce/deps/telemetry/src/telemetry.erl:272: :telemetry.span/3
    (phoenix_live_view 0.18.11) lib/phoenix_live_view/diff.ex:206: Phoenix.LiveView.Diff.write_component/4
    (phoenix_live_view 0.18.11) lib/phoenix_live_view/channel.ex:541: Phoenix.LiveView.Channel.component_handle_event/6
    (stdlib 3.14.2) gen_server.erl:689: :gen_server.try_dispatch/4
    (stdlib 3.14.2) gen_server.erl:765: :gen_server.handle_msg/6
    (stdlib 3.14.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: %Phoenix.Socket.Message{event: "event", join_ref: "17", payload: %{"cid" => 3, "event" => "save", "type" => "form", "value" => "_method=put&_csrf_token=Oz0iEVQDDRw3EHJdBw8IAAAgeh4CPjdqVNNP1gyHYiK2vEcaLPKp0JCG&shop%5Bname%5D=Let+it+beer+Palermo&shop%5Bslug%5D=let-it-beer-palermo&shop%5Bdescription%5D=A+beer+in+the+life%3A+craft+beer&shop%5Btelephone%5D=%2B54+9+11+2345+6789&shop%5Bbanner_message%5D=We+deliver+fresh+products+from+Mondays+to+Sundays+between+9%3A00+a.m.+and+11%3A00+p.m.&shop%5Baddress%5D=Rep%C3%BAblica+de+Eslovenia+1831%2C+C1426CZE+CABA"}, ref: "43", topic: "lv:phx-FzyrmboYBOHOTgFC"}
  1. Refresh the browser and the avatar should have a picture but the banner doesn't. The avatar is uploaded to cloudinary while the banner is not. The state for the banner is null

Expected behavior:

A clear and concise description of what you expected to happen.

Both photos should be uploaded. If cloudinary is not available then at least both photos should remain saved in uploads and shown in the page after the Save button is clicked.

System information (please complete the following information):

  • OS: Ubuntu
  • Browser: Brave
  • Version: 1.47.171
  • Elixir version: 1.12.3
  • Erlang version: 23.3.4

Run: elixir --version to get the Elixir and Erlang/OTP version.

@sgobotta sgobotta added the bug Something isn't working label Jan 22, 2023
@sgobotta
Copy link
Owner Author

The watcher for media files (png, jpg, jpeg) in the Endpoint reloaded once the first image was uploaded, thus the thread that was supposed to consume the second file raised. It's fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant