Skip to content

Bug: Highlighting not working with embedded LiveViews#797

Merged
hhubert6 merged 8 commits intomainfrom
772-highlighting-does-not-work-with-embedded-liveviews
Oct 22, 2025
Merged

Bug: Highlighting not working with embedded LiveViews#797
hhubert6 merged 8 commits intomainfrom
772-highlighting-does-not-work-with-embedded-liveviews

Conversation

@hhubert6
Copy link
Contributor

The problem is that debugger connect to the client via websocket using single root socket id but when dealing with "embedded" LiveViews there is more than one.

Solution I came up with:

  • when route is rendered as regular LiveView with embedded LiveView: for communication find socket_id of regular LiveView (it's the only LiveView on transport_pid that is neither embedded nor nested)
  • when route is controller with embedded LiveView: send all root socket ids found on the page when connecting to websocket and subscribe to multiple 'client:socket_id' topics

Also fixes #723

@hhubert6 hhubert6 linked an issue Oct 14, 2025 that may be closed by this pull request
Copy link
Contributor

@GuzekAlan GuzekAlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@hhubert6 hhubert6 requested a review from GuzekAlan October 17, 2025 15:57
Copy link
Member

@kraleppa kraleppa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a feeling that ideally would be to send messages to the browser based on the window_id, but it may be hard to achieve until we complete #778

For now this solution is good enough, but we may want to revisit it in #778 to simplify it a bit

Anyway, good job!

@hhubert6 hhubert6 merged commit 0267a74 into main Oct 22, 2025
2 checks passed
@hhubert6 hhubert6 deleted the 772-highlighting-does-not-work-with-embedded-liveviews branch October 22, 2025 07:06
hhubert6 added a commit that referenced this pull request Nov 4, 2025
* Fix

* Fix finding root element id when inspecting embedded LiveView

* Send list of all root socket ids via websocket when no main LiveView

* Subscribe client channel to all root socket ids

* Remove alias

* Fix test

* Update assets

* CR suggestions
hhubert6 added a commit that referenced this pull request Nov 4, 2025
* Fix finding root element id when inspecting embedded LiveView

* Send list of all root socket ids via websocket when no main LiveView

* Subscribe client channel to all root socket ids

* Fix test

* Update assets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Highlighting does not work with embedded LiveViews Inspecting not working with Embedded Live Views

4 participants