Skip to content

fix(org-browser): deduplicate metadata list results to prevent tree registration errors#7321

Merged
mshanemc merged 4 commits into
developfrom
cristi/deduplicate-metadata-list-7212
Jun 1, 2026
Merged

fix(org-browser): deduplicate metadata list results to prevent tree registration errors#7321
mshanemc merged 4 commits into
developfrom
cristi/deduplicate-metadata-list-7212

Conversation

@CristiCanizales

Copy link
Copy Markdown
Contributor

Summary

  • Adds deduplication to performListMetadata in metadataDescribeService.ts to handle the Metadata API returning duplicate FileProperties for the same component
  • This prevents the Org Browser TreeView from crashing with "Element with id CustomObject:Account is already registered"
  • Root cause is a Metadata API bug that returns duplicate entries (confirmed in orgs with Person Account enabled); support cases have been filed

Fixes #7212

Test plan

  • Connect to an org with Person Account enabled (which causes duplicate Account in sf org list metadata --metadata-type CustomObject)
  • Open the Org Browser and expand Custom Objects
  • Verify no "already registered" error appears and Account shows up once
  • Verify other metadata types still load correctly

🤖 Generated with Claude Code

…egistration errors

The Metadata API can return duplicate FileProperties for the same component
(e.g. Account appearing twice in orgs with Person Account enabled). This causes
the Org Browser TreeView to crash with "Element with id CustomObject:Account is
already registered". Deduplicate after sorting since duplicates are adjacent.

Fixes #7212

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@CristiCanizales CristiCanizales requested a review from a team as a code owner May 14, 2026 13:12
@CristiCanizales CristiCanizales self-assigned this May 14, 2026
CristiCanizales and others added 3 commits May 20, 2026 10:33
Extract the fullName dedup into a named Effect Equivalence colocated
with FilePropertiesSchema, and use Arr.dedupeAdjacentWith instead of an
inline index filter. Decode now runs before sort/dedup so the
Equivalence operates on decoded values. Adds unit tests covering sort,
single-object coercion, dedup, and combined cases.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mshanemc mshanemc merged commit 69936c1 into develop Jun 1, 2026
88 of 92 checks passed
@mshanemc mshanemc deleted the cristi/deduplicate-metadata-list-7212 branch June 1, 2026 16:10
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.

SFDX Metadata Cursor: Element with id CustomObject:Account is already registered

2 participants