calculate children_cids in Phoenix.LiveView.Debug - #4358
Conversation
|
Feedback from Codex I think this is acceptable. |
|
|
||
| socket = | ||
| put_in(socket.private.children_cids, children_cids) | ||
| socket |
There was a problem hiding this comment.
Maybe a simpler approach is to store it in socket.private.parent_cid instead?
There was a problem hiding this comment.
I don't understand this comment. We store it in socket.private
There was a problem hiding this comment.
Sorry. Basically I wanted to avoid changing the {cid, id, new?, new_assigns} tuples by storing it somewhere else. Either permanently in the socket, as part of new?, or so forth.
There was a problem hiding this comment.
I don't see an obviously better way. We only have the child socket later in render_pending_components. This line you commented on is the parent socket.
We could make it
{cid, id, %{new?: new?, parent_cid: parent_cid}, new_assigns}but I don't think it's much better and we have an extra map. If we're not happy with this, we can also keep things as is. So far nobody complained that children_cids can be incomplete 😅
There was a problem hiding this comment.
Yeah, I think both approaches will be somewhat equivalent by the end of the day. There is the additional traversal in the other one but we may be fine. Your call!
Relates to #4357.
Relates to #4356.