liveview-native / liveview-client-html

MIT License
2 stars 1 forks source link

Simple form not valid inside of html template. #3

Open BrooklinJazz opened 2 months ago

BrooklinJazz commented 2 months ago

I noticed the simple_form component doesn't seem to work when using the liveview-client-html library with a render component.

Here's my template:

<h1 class="text-2xl">Chat App</h1>
<section class="h-[400px] overflow-y-scroll">
    <%= for message <- @messages do %>
    <p><%= message.name %></p>
    <p class="mb-2"><%= message.content %></p>
    <% end %>
</section>

<.simple_form for={@form} id="form" phx-submit="send-message">
    <.input field={@form[:name]} placeholder="From..." />
    <.input field={@form[:content]} placeholder="Say..." />
    <:actions>
        <.button type="submit">
            Send Message
        </.button>
    </:actions>
</.simple_form>

Here's my render component:

defmodule ChatWeb.ChatLive.HTML do
  use ChatNative, [:render_component, format: :html]
end

Very weirdly it's interpreted as text. (see the image below)

Screenshot 2024-08-23 at 11 50 24 AM
bcardarella commented 2 months ago

@BrooklinJazz are you using ~H or ~LVN ?

BrooklinJazz commented 2 months ago

For the render function, I'm using ~H

BrooklinJazz commented 2 months ago

But in the example, I'm using a separate template file

trentjones21 commented 6 days ago

@BrooklinJazz Did you ever figure this out? I'm having the same issue when using a template file. Seems to work in a render/2 function but just prints out the HTML as text in a template file.

bcardarella commented 6 days ago

The issue is related to the Native module. I've got a local working branch to fix this but I'm currently in the middle of implementing LiveComponents in LVN and will circle back to resolve this problem after. Sorry!