This repository was archived by the owner on Feb 10, 2026. It is now read-only.
Upgrade to LiveView 1.1 - cont#244
Closed
DGollings wants to merge 12 commits intoliveview-native:mainfrom
Closed
Conversation
Upgrade phoenix_live_view from ~> 1.0.18 to ~> 1.1.0 to support template resolution changes and new rendering optimizations. Add lazy_html dependency for HTML parsing in tests, required by LiveView 1.1's test infrastructure. Use override: true for phoenix_live_view as live_view_native_test_endpoint requires an older version (~> 1.0.0-rc.8).
Implement annotate_slot/4 callback in Template.Engine as required by Phoenix.LiveView.TagEngine behavior in LiveView 1.1. Update Diff.render call to use LiveView 1.1 signature (4 parameters instead of 3) in rendered_to_diff_string helper. Add LazyHTML handling in ClientProxy.init to convert LazyHTML structs to strings before parsing, as LiveView 1.1 returns HTML responses as LazyHTML structs instead of plain strings.
Add missing template resolution logic to ViewTree.deep_merge_diff that prevents template position collisions from breaking rendering when subsequent patches contain incompatible template positions. Phoenix LiveView 1.1 introduced a template sharing optimization where comprehensions reference templates by integer position. When merging diffs from different renders, these position references can collide. The fix resolves integer template position references to literal static part lists during the merge operation, preventing collisions. This brings the diff merging behavior in line with Phoenix LiveView 1.1's implementation by: - Adding module attributes @template, @Keyed, @keyed_count - Adding template resolution clause to deep_merge_diff/2 - Implementing resolve_templates/2 helper functions
Add test/live_view_native/test/diff_test.exs with 5 tests covering template resolution and diff merging behavior, matching Phoenix LiveView 1.1's test suite. Improve ViewTree.deep_merge_diff to properly handle keyed comprehensions: - Add dedicated clause for @Keyed maps that iterates through positions - Handle nil, integer, map, and [position, map] values in comprehensions - Properly handle keyed_count of 0 by replacing instead of merging - Add struct guard to resolve_templates to prevent attempting to enumerate struct fields All 372 tests pass. Test cases added: - "merges unless static" - basic diff merging - "resolves moved comprehensions" - template position collision fix - "no warning when keyed count is 0" - edge case handling - "ignores structs when resolving templates" - struct handling - "copies streams" - stream metadata preservation
Remove tests that LiveView 1.1 removed to maintain parity: - Remove 6 patch_id tests from view_tree_test.exs LiveView 1.1 moved these from tree_dom_test.exs (removed the entire patch_id describe block). LVN had kept these tests, but for parity with LiveView 1.1's test structure, they should be removed. - Remove merge_diff test from view_tree_test.exs This test now lives in diff_test.exs (added in previous commit). LiveView 1.1 removed it from tree_dom_test.exs. After these removals: - view_tree_test.exs: 108 lines, 4 tests (matches LiveView 1.1's tree_dom_test.exs) - diff_test.exs: 109 lines, 5 tests (matches LiveView 1.1's diff_test.exs) Note: The "consume-and-redirect" test was not added because it existed in LiveView 1.0 but LVN intentionally excluded it in their original port. Maintaining LVN's original design decisions. All 365 tests pass.
Update live_view_native_test_endpoint to latest main which supports LiveView 1.1, removing the need for override: true.
Contributor
|
Hi, sorry but this project has been discontinued. It was announced a few months ago. You're welcome to fork of course, it's MIT licensed. |
Author
|
ah, that's fine, did not see the announcement anywhere (maybe archive this project?) |
Contributor
|
yeah good point, will do! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on top of #243, but extended with
liveview-native/liveview-native-live-form#33
liveview-native/live_view_native_stylesheet#100
liveview-native/liveview-native-core#448
liveview-native/liveview-client-jetpack#500
has all the changes I needed to make to make a simple, but not entirely toy demo app work.
Tested are conditionals, small patches, large patches, components, stylesheets and multiple parallel updates.
Fixes a bunch of changes in the liveview protocol and (possibly random) things encountered.
I'm not sure if there is an AI policy, but this was mostly generated uet manually tested and trimmed to as little as possible (as far as I can determine)
Doubt all or even any of these PRs are merge-able as-is, but they should offer a good starting point to making live-view-native compatible with recent Phoenix installations