fix: render unique ids for nested embeds in show view#141
Merged
Conversation
Ubuntu's nodejs/npm pulls in libnode-dev, which now collides with NodeSource's nodejs 18 over /usr/include/node/common.gypi. Letting NodeSource install both avoids the conflict.
Nested detail_view ids and tab hrefs were built from the parent's @id only, ignoring the parent's index in its own embed list. With two parent embeds each containing the same child embed, both children rendered with identical DOM ids and identical tab hrefs.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
embeds_manyrendered child detail-views with non-unique DOM ids and non-unique tab hrefs. With two parent embeds each containing the same child embed, only one child node was reachable; LiveView raised "Duplicate id found" errors.detail_view/1constructed nested ids and tab hrefs from the parent's@idonly, ignoring the parent's index in its own embed list.indexed_id/2helper and use it for the outer div id, embed tab hrefs, the expand modal id, and the nested<.detail_view>id. Renamed:currentattr to:current_indexand:lastattr to:sibling_countto reflect intent.Also drops
nodejs npmfrom the first apt step in the Dockerfile — Ubuntu'snpmnow pulls inlibnode-dev, which collides with NodeSource's nodejs 18 over/usr/include/node/common.gypi.Test plan
container_test.exsreproduces the duplicate-id failure before the fix and passes aftermix testsuite passes (31 tests)mix format --check-formattedclean for changed files