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
Browsers you attempted to reproduce this bug on (the more the merrier):
Does the problem persist after removing "assets/node_modules" and trying again? Yes/no:
Actual behavior
Using render_hook(element(view, "#hook-el-id"), "event", map) requires #hook-el-id to have a phx-target attribute for the render_hook/3 to work.
Expected behavior
The phx-target attribute seems to not be required outside of tests and it would seems to hold the same value as data-phx-component anyways. My expectation would be that phx-target shouldn't be required for render_hook/3 as well.
The text was updated successfully, but these errors were encountered:
If you are pushing events from a hook to a component, then you must pass an element, created with element/3, as first argument and it must point to a single element on the page with a phx-target attribute in it:
The requirement that it must be a single element seems inconvenient, especially when my phx-hook (and therefore phx-target) is on a div containing other elements.
I had a test for a sortable list <div phx-hook="Sortable" working just fine with render_hook(view, "update-sorting", %{"ids" => sort}), but the moment I tried to use it in the Table component <tbody phx-hook="Sortable" phx-target="sortable-table, render_hook no longer returns the updated result, or complains about the selector not returning a single element.
Environment
Actual behavior
Using
render_hook(element(view, "#hook-el-id"), "event", map)
requires#hook-el-id
to have aphx-target
attribute for therender_hook/3
to work.Expected behavior
The
phx-target
attribute seems to not be required outside of tests and it would seems to hold the same value asdata-phx-component
anyways. My expectation would be thatphx-target
shouldn't be required forrender_hook/3
as well.The text was updated successfully, but these errors were encountered: