Notably, it only contains information about the person, since that is the only assign that changed in the LiveView. This is a special key LiveView keeps alongside the application’s assigns in order to track what values have changed between successive renders.īy using the proper syntax, _changed_ has been automatically derived from the state of the LiveView and passed down to the function component. %Īh-ha! Here is a first look at the _changed_ field. To render a simple piece of markup, it’s common to leverage basic language constructs-a view helper function that returns a string. This article will explore these examples and a couple others, and demonstrate how to detect and resolve them. The LiveView docs outline a couple of pitfalls in this regard. These inefficiencies are not always immediately apparent, especially when testing the application locally, because the application will appear to display correctly and function as intended. In some circumstances, it may even send diffs when nothing has changed at all! There are some subtle ways to accidentally undermine LiveView’s ability to track changes and, in those cases, LiveView will often fall back to the worst-case scenario: re-rendering a larger portion of HTML than is necessary and sending it across the wire, even if most of it is unchanged. Put another way, LiveView strives to send only what has changed, when it changes. One of the tentpoles of its approach to ensure application responsiveness is to send only very small HTML changes (“diffs”) across a persistent WebSocket connection. Phoenix LiveView empowers Elixir developers to write rich, interactive web applications rendered entirely on the server.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |