Skip to content

Conversation

SteffenDE
Copy link
Contributor

@SteffenDE SteffenDE commented Aug 18, 2025

Claude generated this code and I think it's wrong. When using this in a LiveView branch to do teleportation, I'm seeing very flaky tests: phoenixframework/phoenix_live_view#3952

I'm thinking we may just document that LiveViewTest does not teleport and if you want to assert, you need to assert on the HTML output of render(view).

@josevalim
Copy link
Member

We typically do tree traversion in LiveView. Shouldn't we do that instead of mutation?

@SteffenDE
Copy link
Contributor Author

@josevalim the issue is that .portal supports arbitrary selectors and we don't have a mechanism to evaluate a selector when traversing the tree

@josevalim
Copy link
Member

I wonder if we could have a simpler function that annotates all nodes that match a selector with a special attribute, then we convert it to a tree and find those attributes? easier than moving nodes around?

@SteffenDE
Copy link
Contributor Author

That would work too, but I'm currently thinking we just don't add teleportation at all, since if you teleport to something outside of the LiveView, like the root layout, asserting in LiveViewTest would still fail. We can still decide if a annotate functionality would be useful in general.

@josevalim
Copy link
Member

maybe instead we should have a function like assert teleported?(view, foo, bar) that does the assertion that it would teleport there?

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.

2 participants