Questions tagged [phoenix-live-view]

Phoenix LiveView is a feature of Elixir's Phoenix framework that enables rendering web pages on the server via HEEx templates, and updating them via websockets / Phoenix Channels. Use this tag together with [elixir] and/or [phoenix-framework] for questions specific to this feature.

Official github repository: https://github.com/phoenixframework/phoenix_live_view

138 questions
3
votes
0 answers

Detect key combinations in Phoenix LiveView (e.g. Cmd + F)

I would like to avoid using hooks for that. Is it possible to handle key combination for live views ? Especially for Cmd + LETTER, and Cmd + Shift + LETTER.
popo63301
  • 509
  • 1
  • 4
  • 10
3
votes
1 answer

Render different live template name in Phoenix LiveView

In a regular controller/view, let's say I have AppWeb.ItemView, and AppWeb.ItemController. Let's say I have two different indexes, :index and :index_funky. If I wanted to render index.html.eex for the :index_funky view, I could create a render…
Brendon
  • 879
  • 1
  • 6
  • 18
3
votes
2 answers

How do you clear a textarea in a Phoenix LiveView form?

I have a Phoenix LiveView with a form that is not backed by a data layer, like so: <%= f = form_for :post, "#", [phx_submit: :create_post %> <%= textarea f, :message, placeholder: "Say something:" %> <%= hidden_input f, :user_id, value:…
vaer-k
  • 10,923
  • 11
  • 42
  • 59
3
votes
1 answer

How do I tell a Phoenix LiveView to update?

I understand that I can get the liveview to update by including something like: if connected?(socket), do: :timer.send_interval(10000, self(), :click) But, is there a way to trigger this from somewhere else in my application? For example, if you…
cjm2671
  • 18,348
  • 31
  • 102
  • 161
3
votes
2 answers

Elixir / Phoenix LiveView: How can I report exceptions to Rollbar?

I've had a lot of fun playing around with the still-beta Phoenix LiveView library. One thing that I'm confused about is how to ensure that my LiveViews will behave in a predictable and transparent way when an exception occurs. In a conventional…
Topher Hunt
  • 4,404
  • 2
  • 27
  • 51
2
votes
2 answers

Trying to Update Elixir Phoenix Liveview to Version 0.18.16, Getting Strange Error

I am trying to update my liveview from v0.17.5 to v0.18.16. I put this in my mix.exs file: {:phoenix_live_view, "~> 0.18.16"}, {:floki, ">= 0.30.0", only: :test} but I get error Because your app depends on phoenix_live_view empty which doesn't…
paulrusu
  • 117
  • 1
  • 7
2
votes
1 answer

What is the correct way to implement Alpine.js and Phoenix 1.7 initialization with LiveView 0.18.3?

I'm having trouble getting Alpine and Phoenix LiveViews to work together. With the code provided below, liveview phx-click events do not fire, but Alpine works. CSS animations specified by Tailwind do not activate as they should on page load, but…
vaer-k
  • 10,923
  • 11
  • 42
  • 59
2
votes
0 answers

Ecto - How to populate List of IDs in Schema Elixir Postgres

I'm getting response from Ecto Schema query with joins multiple tables. Here is my query: query = from( item in ItemSchema, join: item_cat in ItemCategorySchema, on: item.item_category_id ==…
hassan
  • 57
  • 7
2
votes
1 answer

How to make a variable globally accessible across multiple templates

In my phoenix app, I am trying to load a bunch of data and make them accessible to my root template (across all pages). To my knowledge, this is done via assigns, but I don't know where to load it. I think something like use App.LiveView use…
flaudre
  • 2,358
  • 1
  • 27
  • 45
2
votes
1 answer

Elixir Desktop has dialyzer issues in MenuBar

Background I have a small app using Elixir Desktop. This app works relatively well and launches without issues: https://github.com/Fl4m3Ph03n1x/market_manager/tree/master/apps/web_interface However, I have dialyzer complaining about types. I am not…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
2
votes
2 answers

Phoenix LiveView form submit, clear/reset input value

I have created this simple form which I handle in my LiveView component. What is the communities best practice for clearing / resetting my form after I submit this? I do want to take validations etc. into account. Is this then always via an…
Hoetmaaiers
  • 3,413
  • 2
  • 19
  • 29
2
votes
1 answer

Phoenix Live View - 'mount' gets called multiple time when subscribed to a publisher

I encountered a problem inside my demo phoenix application. The application consists of an api which listens for message jsons and creates an appropriate entry into the ecto data base. defmodule ServerLive.Messages.Message do use Ecto.Schema …
2
votes
1 answer

Unknown registry: MyApp.Pubsub

Background I have a Phoenix LiveView App inside an umbrella project which is basically a HelloWorld project. In This Phoenix App is special though, in that it is a Desktop App: https://github.com/elixir-desktop/desktop My Phoenix app does not use…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
2
votes
1 answer

Making desktop apps in Elixir

Background In my quest to make a desktop app with Elixir for Windows (I have given up the idea of doing multi-desktop apps for now) I am trying to create a HelloWorld Desktop app. This app is basically what you get from running mix phx.new hello. I…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
2
votes
1 answer

JS.__struct__/1 is undefined, cannot expand struct JS

I try to walk through an JS example of the LiveView 0.17.1 docs (https://hexdocs.pm/phoenix_live_view/0.17.1/Phoenix.LiveView.JS.html) So I created a new Phoenix 1.6.2 application with mix phx.new demo3 --no-ecto and changed the mix.exs deps part to…
wintermeyer
  • 8,178
  • 8
  • 39
  • 85
1
2
3
9 10