Skip to content

fix: dedupe anchor ids in link settings dropdowns#351

Merged
tristan-mouchet merged 1 commit into
developfrom
fix/duplicate-anchor-id-dropdown-keys
Jun 12, 2026
Merged

fix: dedupe anchor ids in link settings dropdowns#351
tristan-mouchet merged 1 commit into
developfrom
fix/duplicate-anchor-id-dropdown-keys

Conversation

@tristan-mouchet

Copy link
Copy Markdown
Collaborator

Summary

Selecting a link layer could log a React "two children with the same key" warning. The anchor selection dropdown lists every element with a custom HTML id and keyed each option by that id, so two layers sharing an id (e.g. duplicated component instances) produced duplicate keys.

Changes

  • Deduplicate by anchor id in findLayersWithAnchorId, fixing all anchor dropdowns (link settings, rich text link settings, collection link field input). An #id link resolves to the first match, so each anchor only needs to appear once — this also removes confusing duplicate options.

Test plan

  • Open a page where two elements share the same custom HTML id
  • Select a link/button layer and open the Anchor dropdown — no duplicate-key warning in the console
  • Confirm the shared id appears only once in the dropdown and linking to it still works

Two layers can share the same custom HTML id (e.g. duplicated component
instances), so the anchor selection dropdown rendered duplicate options
keyed by that id, triggering React duplicate-key warnings. Deduplicate
by anchor id in findLayersWithAnchorId; an #id link resolves to the
first match anyway, so each anchor only needs to appear once.
@tristan-mouchet tristan-mouchet added the Bug Something isn't working label Jun 12, 2026
@tristan-mouchet tristan-mouchet self-assigned this Jun 12, 2026
@tristan-mouchet tristan-mouchet merged commit 05c1aa7 into develop Jun 12, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant