You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Works well but when i try to handle an event like this
defmodule SvelteDemoWeb.ExampleTwo do
use SvelteDemoWeb, :live_view
def mount(_params, _session, socket) do
socket =
assign(socket,
number: 2
)
{:ok, socket}
end
def handle_event("increase", _, socket) do
# This will show in the console when the button is clicked
IO.inspect(socket.assigns.number)
{:noreply, assign(socket, :number, socket.assigns.number + 1)}
end
def render(assigns) do
IO.inspect(assigns.number, label: "Rendered number")
~H"""
<div class="flex items-center justify-evenly">
<div class="">
<%= @number %>
<button phx-click="increase">Increase server</button>
</div>
<.svelte name="ExampleTwo" props={%{number_live: @number}} socket={@socket} />
</div>
"""
end
end
The DOM don't update the number and show me this in the browser
hooks.js:9 Uncaught TypeError: Cannot read properties of undefined (reading 'parentNode')
at detach (hooks.js:9:10)
at Object.update (hooks.js:31:21)
at ViewHook.updated (hooks.js:120:35)
at ViewHook.__updated (view_hook.js:34:37)
at view.js:489:55
at dom_patch.js:79:56
at Array.forEach (<anonymous>)
at DOMPatch.trackAfter (dom_patch.js:79:36)
at dom_patch.js:348:32
at Array.forEach (<anonymous>)
The text was updated successfully, but these errors were encountered:
I have a component name Shell.svelte
en when I use as layout like this in app.html.heex:
Works well but when i try to handle an event like this
The DOM don't update the number and show me this in the browser
The text was updated successfully, but these errors were encountered: