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

fix various issues with limiting streams #3035

Merged
merged 5 commits into from
Jan 24, 2024

Conversation

SteffenDE
Copy link
Collaborator

@SteffenDE SteffenDE commented Jan 21, 2024

997f15c introduces an issue where limits were not correctly enforced when adding items in bulk, this PR addresses this.

It also fixes an issue with limits being applied differently on resets, because we previously did not remove stream elements when they were being re-added later. I think this was initially introduced to avoid issues with live components not being correctly rendered because of the PHX_SKIP optimization. To counteract this, we now remove all elements on reset to force them being added in the correct order, but also store the live component DOM nodes to correctly restore them.

References #2686.

@SteffenDE SteffenDE marked this pull request as ready for review January 21, 2024 16:16
phoenixframework@997f15c
introduces an issue where limits were not correctly enforced when adding
items in bulk.

It also fixes an issue with limits being applied differently on resets,
because we previously did not remove stream elements when they were being
re-added later. I think this was initially introduced to avoid issues
with live components not being correctly rendered because of the PHX_SKIP
optimization. To counteract this, we now remove all elements on reset to
force them being added in the correct order, but also store the live
component DOM nodes to correctly restore them.

References phoenixframework#2686.
lib/phoenix_live_view.ex Outdated Show resolved Hide resolved
@chrismccord chrismccord merged commit 859281c into phoenixframework:main Jan 24, 2024
5 checks passed
@chrismccord
Copy link
Member

❤️❤️❤️🐥🔥

SteffenDE added a commit to SteffenDE/phoenix_live_view that referenced this pull request Feb 11, 2024
This is a followup to phoenixframework#3070 and phoenixframework#3035.

When adjusting the stream component restore functionality in phoenixframework#3070, I
accidentally broke live components in streams, but the tests did not
detect this because they only checked the id of the stream items and not
their content. Therefore, this commit also adjusts the tests.

Another problem that was introduced in phoenixframework#3035 by not leaving re-inserted
items in the DOM is that nested streams inside live components inside
streams would not be restored properly. This commit addresses this by
recursively running morphdom on the restored stream items.
chrismccord pushed a commit that referenced this pull request Feb 14, 2024
This is a followup to #3070 and #3035.

When adjusting the stream component restore functionality in #3070, I
accidentally broke live components in streams, but the tests did not
detect this because they only checked the id of the stream items and not
their content. Therefore, this commit also adjusts the tests.

Another problem that was introduced in #3035 by not leaving re-inserted
items in the DOM is that nested streams inside live components inside
streams would not be restored properly. This commit addresses this by
recursively running morphdom on the restored stream items.
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