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
1
vote
1 answer

How to use render_change result to match specific element?

I'm testing LiveView form with render_change/2 html = view |> element("#filter-form") |> render_change(%{filter: %{days: "14"}}) The result I get is a string containing rendered html. I want to assert that the result has some specific…
achempion
  • 794
  • 6
  • 17
1
vote
1 answer

Phoenix Live View keeps rebuilding a DOM element with phx-update="ignore"

In my contrived chat app, I have a timestamp at the bottom that is supposed to tell when the page loaded. Adding chats should not change it, and I included a phx-update="ignore" attribute on the div containing the timestamp to prevent that:
ijt
  • 3,505
  • 1
  • 29
  • 40
1
vote
1 answer

How do I prevent a Phoenix Live View from removing DOM elements put there by JavaScript?

I haven't yet found a way to consistently prevent Phoenix Live Views from removing elements from the DOM that were put there by JavaScript. Here is a snippet from a crude chat app that uses JavaScript to add a smiley face after the page…
ijt
  • 3,505
  • 1
  • 29
  • 40
1
vote
1 answer

How do I get a static route in a Phoenix live view?

In my live view template I added this snippet: That produced the following error: How can I fix this?
ijt
  • 3,505
  • 1
  • 29
  • 40
1
vote
1 answer

x-data reset on every refresh in alpinejs with tailwind css

tailwindcss and phoenix liveview. My code look like this
Sub menu
And First loaded page, even though…
freewebwithme
  • 429
  • 12
  • 22
1
vote
1 answer

Mix release not working on Phoenix live view demo app

Background I am toying with Phoenix LiveView and I have setup an app with mix phx.new demo --live --no-ecto. My primary objective is to create a release of this app, so then I can adapt it to what I need, but I am having trouble. Problem In order to…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
1
vote
1 answer

Can you override phoenix templates partials with block supers (like Django?)

What is the recommended way to differentiate a HTML block in phoenix templating? I've read the documentation; which draws the following outlines; the root layout is injected by a plug in the router you can optionally set a layout on a route you can…
Hedde van der Heide
  • 21,841
  • 13
  • 71
  • 100
1
vote
1 answer

Get all live routes dynamically from phoenix router

I want to create a page in Phoenix that it would have links to all 'live' routes declared in the router.ex file. For example : ... live "/", PageLive live "/light", LightLive live "/license", LicenseLive live "/sales-dashboard",…
1
vote
1 answer

Phoenix Liveview - Websocket connect_info blocking iframe content

I'm actually working on a phoenix app which I require to render in some websites embeded on an iframe, I finished coding the logic but I found that it was only working on Firefox, when using it on Chome or Opera, it end on an infinite loop…
Lorenzo Zuluaga
  • 125
  • 1
  • 3
  • 8
1
vote
1 answer

no function clause matching in ProyectWeb.PageLiveView.handle_info/2

I don't know how I can match my asynchronous function and my handle_info this code works: def order_month() do Task.async(fn -> (1..12) |> Enum.map(fn a -> %{months: a} |> Map.put(:order_months, Proyect.BuyHandler.order_month(a |>…
1
vote
1 answer

Live View app is constantly reloading after fresh install

I just generated a fresh live view app with phx.new --live and I'm getting this error constantly: [info] GET /orgs [debug] Processing with Phoenix.LiveView.Plug.index/2 Parameters: %{} Pipelines: [:browser] [debug] QUERY OK source="orgs"…
JustGage
  • 1,534
  • 17
  • 20
1
vote
1 answer

How to stop page refresh in a Liveview template

My LiveView app sets some initial states (e.g, button_label) in the mountfunction. The template appears to be re-mounted as it goes through some message passing. In the following example, the button label is initially set to "Click to run", and…
Jason O.
  • 3,168
  • 6
  • 33
  • 72
1
vote
1 answer

Phoenix LiveView form_for raising NoRouteError at POST

So I'm trying to make a phoenix live view application, and I came across a problem when I tried to implement it into my already existing project. I made a form using the form_for that phoenix.html provides, and it makes a post request to the server…
oriont
  • 684
  • 2
  • 10
  • 25
1
vote
1 answer

Is there a way to launch the browser automatically upon starting the server in Phoenix?

I have a Phoenix (1.4) LiveView (0.8) application, and I'd like to have the browser window open automatically upon starting the server. Does anyone know if this can be done, and if so how? I tried seeing if I could configure the option in Webpack…
ernbrn
  • 387
  • 3
  • 6
1
vote
2 answers

why phoenix liveview update/assign message make client contenteditable value revert?

With Phoenix live view document I add a live page for writing a realtime form app. There is very simple demo:

Hello

Counter is222: <%= @counter %>
LoranceChen
  • 2,453
  • 2
  • 22
  • 48