Skip to content

[Bug]: TextEditor's text not reset on form submission #30

@nighthawk

Description

@nighthawk

What happened?

My LVN template includes a <.form for={@comment_form}> with with a <TextEditor> for users to post a comment. This works except that the form isn't cleared after I submit it, even though I explicitly reset that comment_form.

It works fine in the HTML version.

The relevant part of the .neex looks like this:

<VStack spacing="0">
  <List>...</List>
  <Divider />

  <.form
    for={@comment_form}
    id="comment-form"
    phx-change="validate"
    phx-submit="save"
  >
    <HStack>
      <TextEditor id="content" name="comment[content]" />

      <LiveButton type="submit">
        <Image systemName="paperplane.circle.fill" />
      </LiveButton>
    </HStack>
  </.form>
</VStack>

And the handle_event("save", ...) then does this:

  def handle_event("save", %{"comment" => comment_params}, socket) do
    # code to save the comment...

     another_comment_changeset =
          %Comment{} |> Discussions.change_comment()

    {:noreply,
    socket
    |> assign(:comment_form, to_form(another_comment_changeset))}
  end

Library Version

0.4.0-rc.0

Xcode Version

16.2

Swift Version

6.0.3

On which device or simulator are you running into the problem?

iPad

Target Device Operating System Version

18.2

Relevant log output

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions