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
Conditional rendering seems to cause events to sometimes be sent to the wrong component #3200
Comments
mattnenterprise
changed the title
Conditional rendering seems to cause events to sometimes be sent to the wrong component.
Conditional rendering seems to cause events to sometimes be sent to the wrong component
Apr 4, 2024
@mattnenterprise this shouldn't happen if you change the @chrismccord I think we have a deeper problem when performing form recovery on forms with phx-target="selector". It could be that the selector points to multiple DOM elements. How should we handle this? Currently we never find the new component ID here:
|
SteffenDE
added a commit
that referenced
this issue
Apr 6, 2024
This commit refactors the form recovery feature to run after the initial mount patch. This has two benefits: 1. We can use the default withinTargets handling to ensure that we always send the event to the correct target. 2. It allows form recovery to work in nested LiveViews! Fixes #2281. Fixes #3200.
SteffenDE
added a commit
that referenced
this issue
Apr 14, 2024
SteffenDE
added a commit
that referenced
this issue
Apr 14, 2024
SteffenDE
added a commit
that referenced
this issue
Apr 27, 2024
SteffenDE
added a commit
that referenced
this issue
May 3, 2024
SteffenDE
added a commit
that referenced
this issue
May 3, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
Actual behavior
Conditional rendering seems to cause events to sometimes be sent to the wrong component.
To reproduce using the following single file example:
Do the following steps.
main.exs
elixir main.exs
http://localhost:5001/settings_tab
in the browser.Messages tab
button.elixir main.exs
command running the server.elixir main.exs
If the following code in the example file
if changed to
then the form recovery event is sent to the correct component. This seems to suggest some issue with conditional rendering.
Expected behavior
For the phx-change event to be sent to the correct component during form recovery.
The text was updated successfully, but these errors were encountered: