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
8
votes
1 answer

Elixir Phoenix LiveView Echart just vanishes (disappears)

Sorry for the long post, I tried to give all the information and explain what I have already tried. Problem: I put a classic phoenix view into a liveview. While everything seems fine, the echart just vanishes as soon as it's finished painting. There…
Joe Eifert
  • 1,306
  • 14
  • 29
7
votes
3 answers

Elixir phoenix LiveView collapsible collapses on update

Problem LiveView collapses my opened element. Details I have an element that starts off as being collapsed on page load: ...
# content updated by liveview
If a user clicks on the…
Joe Eifert
  • 1,306
  • 14
  • 29
6
votes
2 answers

How can I make an Elixir/Phoenix LiveComponent send a message to itself, not its parent?

I'm writing a ClockComponent to learn about Phoenix LiveComponents. I almost have it, but it's sending the :tick message to its parent. How can I get it to send that message to itself? I wanted to use myself() instead of self() but apparently that's…
ijt
  • 3,505
  • 1
  • 29
  • 40
6
votes
2 answers

Getting the current path in a LiveView

In a normal route: get /index, MyController, :index I can simply get the route from Plug.Conn's path_info function. However if I have a live route, how do I retrieve the current path? live /index, IndexLive
Bargain23
  • 1,863
  • 3
  • 29
  • 50
5
votes
1 answer

How to properly communicate with liveview from javascript

I'm trying to update Liveview with Javascript after a Javascript event is fired. Liveview must show a
element with some values sent from Javascript. My question is: how should I pass those values from Javascript to Liveview? I might also need…
ogr
  • 610
  • 7
  • 23
5
votes
0 answers

Phoenix render LiveView from a regular template or controller

Let say we have LiveView rendered from a router via live "/awesome", AwesomeLive.Index, :index. Now, in order to render it from a regular template or controller we need to use live_render/3. But that won't work, because: cannot invoke…
Wojciech Bednarski
  • 6,033
  • 9
  • 49
  • 73
4
votes
1 answer

Phoenix LiveView Nested Associations Form

I'm experimenting with Phoenix 1.6 and LiveView, and trying to get my nested form/models to work as expected. I have a schema with something like: Parent, Child, where Parent has_many Children // Child belongs_to parent. I have a LiveView component…
mc92
  • 475
  • 5
  • 10
4
votes
1 answer

How to pass plug loaded data to LiveView components

Hi I'm using different domain names to load different data sets. I'm currently using a custom plug to load the correct domain id based on the hostname. E.g. got this in my endpoint.ex just before the router: plug WebApp.DomainCheck socket "/live",…
Dominic
  • 786
  • 6
  • 8
4
votes
2 answers

How to test handle_info/2 in Phoenix LiveView?

Greetings Phoenix LiveView Wizards! Context We have a basic LiveView counter app: https://github.com/dwyl/phoenix-liveview-counter-tutorial The code is very simple: /live/counter.ex The App works as expected, see:…
3
votes
1 answer

Phoenix LiveView Error: no route found for POST

I've got a problem with a live-view form, that apparently sends post requests to the router instead of using the socket connection on submit so i'm getting "no route found for POST /stationen/new (SportfestWeb.Router)" I checked the fixes from this…
David Bald
  • 31
  • 3
3
votes
1 answer

How do I mix live and "dead" content in my Elixir Phoenix LiveView app header?

I changed my root.html.heex file to look like this: ... <%= @inner_content %> And moved the
element to be duplicated in app.html.heex:
Daryl Spitzer
  • 143,156
  • 76
  • 154
  • 173
3
votes
0 answers

Event of child LiveView gets sent to parent

Im rendering a nested (child) LiveView inside my main LiveView. Events inside the child LiveView gets sent to the parent instead of the child. How do i achieve that the child LiveView receives the event and not the parent? I am using…
3
votes
1 answer

How to convert old liveview app to new Phoenix version?

Background I am in the process of porting an old LiveView app to the newest version of Phoenix ( v1.6.5). Being new to the whole thing in general I was expecting to run mix phx.new web_interface --live --no-ecto and to the find a similar structure…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
3
votes
1 answer

Using external libraries in phoenix LiveView

I am trying to integrate the WYSIWYG-Editor tinymce with a phoenix LiveView that contains textarea fields. Before using LiveView, I imported it as a node_module library into the app.js file import tinymce from '../node_modules/tinymce/tinymce' and…
Paul Rousseau
  • 571
  • 2
  • 7
  • 21
3
votes
3 answers

elixir phoenix liveview - passing user id through socket

In liveview, how can I pass the user data from leex to the context? I have phx.gen.live a profiles context, and I want to add user_id to the profile every time user create the new profile. I change the create_profile code to: **profiles.ex…
sooon
  • 4,718
  • 8
  • 63
  • 116
1
2 3
9 10