Skip to content

fix: render unique ids for nested embeds in show view#141

Merged
tfwright merged 2 commits intomainfrom
fix/show-nested-embed-ids
Apr 20, 2026
Merged

fix: render unique ids for nested embeds in show view#141
tfwright merged 2 commits intomainfrom
fix/show-nested-embed-ids

Conversation

@tfwright
Copy link
Copy Markdown
Owner

Summary

  • Bug: in the show view, nested embeds_many rendered 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.
  • Cause: detail_view/1 constructed nested ids and tab hrefs from the parent's @id only, ignoring the parent's index in its own embed list.
  • Fix: extract a small indexed_id/2 helper and use it for the outer div id, embed tab hrefs, the expand modal id, and the nested <.detail_view> id. Renamed :current attr to :current_index and :last attr to :sibling_count to reflect intent.

Also drops nodejs npm from the first apt step in the Dockerfile — Ubuntu's npm now pulls in libnode-dev, which collides with NodeSource's nodejs 18 over /usr/include/node/common.gypi.

Test plan

  • New describe block in container_test.exs reproduces the duplicate-id failure before the fix and passes after
  • Full mix test suite passes (31 tests)
  • mix format --check-formatted clean for changed files

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.
@tfwright tfwright merged commit 49f0c88 into main Apr 20, 2026
6 checks passed
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.

1 participant