Pass changes into on_item_updated
callback
#959
Replies: 5 comments 4 replies
-
Hey, you can retrieve the old item from the socket: def on_item_updated(socket, item) do
socket.assigns.item # old item
item # updated item
end Maybe this helps you already? |
Beta Was this translation helpful? Give feedback.
-
@Flo0807, @wasnotrice sorry if I hijack this thread but it seemed to me the best place to ask this question.
but it is not working. Also tried forcing an error on the changeset both as a Thanks a lot. |
Beta Was this translation helpful? Give feedback.
-
You are right, I forgot to update the UI part.
For the `on_item_updated` maybe it is possible to remove the fixed `{:ok, item}` return and pop up changeset errors assigning them to the socket?
Thanks again
…On Wed, Apr 2, 2025, at 12:09, Florian Arens wrote:
It looks like something is wrong with your setup. Did you properly update your app to Tailwind CSS v4 and daisyUI v5?
See https://hexdocs.pm/backpex/v0-12.html#upgrade-to-tailwind-4-and-daisyui-5
—
Reply to this email directly, view it on GitHub <#959 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAAM6IZEXT75AFDPAX7V3BT2XOZM3AVCNFSM6AAAAABZGCJXVGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTENRZHA4DCMQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hey, this is not possible as |
Beta Was this translation helpful? Give feedback.
-
Great thanks
…On Fri, Aug 22, 2025, at 08:42, Florian Arens wrote:
> For the `on_item_updated` maybe it is possible to remove the fixed `{:ok, item}` return and pop up changeset errors assigning them to the socket?
>
Hey, this is not possible as `on_item_updated` is called after the item has already been updated. We plan to add some hooks that are called before an item has been updated / created. See #982 <#982>
—
Reply to this email directly, view it on GitHub <#959 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAAM6IZ7RI6ZPUPS7PCLE5T3O23VDAVCNFSM6AAAAABZGCJXVGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTIMJYGYZDKMA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to track changes made to my LiveResource. I can implement the
on_item_updated
callback on myLiveResource
, but that callback only gets the updated item. I don't have a way to know what changed. Would it be possible to pass thechangeset.changes
here as well?Instead of the current signature:
we would have:
I'd be happy to work up a PR for this if it makes sense. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions