i-n-g-m-a-r

i-n-g-m-a-r

Live_render/2 how to NOT render many flash_groups

Would it be possible to (re)use a single flash_group ?

# .tool-versions
elixir 1.15.4-otp-26
erlang 26.0.2

# deps
{:phoenix, "~> 1.7.7"},
{:phoenix_html, "~> 3.3"},
{:phoenix_live_view, "~> 0.19.0"},
# router
scope webroot, MyAppWeb do
  get "/", PageController, :home
end

# controller
def home(conn, _params) do
  render conn, :home
end
<!-- home.html.heex -->
<h1>Render StuffLive on homepage</h1>
<%= live_render @conn, MyAppWeb.StuffLive %>

<!-- stuff_live.html.heex -->
<h1>Hello from StuffLive</h1>
<p>Lots of stuff, like flash_groups.</p>

Result:

<div id="client-error"></div>
<div id="server-error"></div>

<h1>Render StuffLive on homepage</h1>

<div data-phx-session="...">
  <div id="client-error"></div>
  <div id="server-error"></div>

  <h1>Hello from StuffLive</h1>
  <p>Lots of stuff, like flashgroups.</p>
</div>

Where Next?

Popular in Questions Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a &gt; b) do {:ok, "a"} end if (a &lt; b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Other popular topics Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

We're in Beta

About us Mission Statement