Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested Liveviews with live components children #3626

Open
dalideco opened this issue Jan 10, 2025 · 0 comments · May be fixed by #3627
Open

Nested Liveviews with live components children #3626

dalideco opened this issue Jan 10, 2025 · 0 comments · May be fixed by #3627
Labels

Comments

@dalideco
Copy link

Environment

  • Elixir version (elixir -v): 1.18.1 (Erlang/OTP 27)
  • Phoenix version (mix deps): 1.7.18
  • Phoenix LiveView version (mix deps): 1.0.1 (also happens when I downgraded to 0.20)
  • Operating system: macOS 14.4.1(Sonoma)
  • Browsers you attempted to reproduce this bug on (the more the merrier): Chrome and Safari
  • Does the problem persist after removing "assets/node_modules" and trying again? Yes/no: Yes

Actual behavior

File App to reproduce the behavior: https://github.com/dalideco/bug-liveview-inside-livecomponent/blob/master/main.exs

The issue arises when trying to use a nested liveview inside a parent live component and that liveview itself has children live components.
The assign updates made in event handlers in the parent live component will run but will not cause the page to update.

  • When running the Example App in the file, you'll notice that when clicking on the + button for every live view/component that the number updates, except for the Parent Live Component.
  • If you look for UNCOMMENT: and uncomment another live component inside the Nested Liveview, you'll notice that the Child Live Component no longer updates the page too.
  • If you comment both live components inside the Nested Liveview, everything will work normally.

My current assumption is that for each live component you add inside the nested liveview, one of the live component parents of the nested liveview will have this problem(From parent to child in order).
The problem never arises in Live Views but only in Live Components.

Expected behavior

Adding Live components inside the nested Live view should not cause its live component parents to stop updating the page when their assigns change through an event handler.

@SteffenDE SteffenDE added the bug label Jan 10, 2025
SteffenDE added a commit that referenced this issue Jan 10, 2025
findExistingParentCIDs did not ignore CIDs in child LiveViews, causing
updates to be ignored in certain cases.

Fixes #3626.
@SteffenDE SteffenDE linked a pull request Jan 10, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants