mortenlund
Hi!
Suggest to add the ability to do use the components socket as input into Phoenix.LiveView.send_update/3 function to make it easier to send an update to self.
Using @myself as an argument is good, but think it would be easier to grasp when just using the current socket.
I think the cid is present in the socket and the module can be fetched using __MODULE__ is guess? ![]()
Example:
@impl true
def update(%{title: title}, socket) do
updated_socket = socket
|> assign(:title, title)
{:ok, updated_socket}
end
@impl true
def handle_event("update_title", %{"title" => title} = _params, socket) do
updated_socket = socket
|> send_update(title: title)
{:noreply, updated_socket}
end
Trending in Proposals: Ideas
We are seeing a lot of warning logs like this:
navigate event to "https://someurl" failed because you are redirecting across live_sessio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 2- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
steffend
You can always write a helper function and import that:
Your example is also a bit contrived, since you could just assign the value directly. Also note that send_update is asynchronous. It sends a message to the LiveView process, which invokes the update callback as soon as it handles the message. If your code relies on some data wrangling
update/2does, you can just directly call update instead:mortenlund
Hi, yes I can write such a function, and I have

Just thought it would be a nice addition to the standard library
And yes, you are right, my example was not very good, and after your example I am not so sure why I did not think of that