Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: component set components are now DecodableMaps #1080

Merged
merged 3 commits into from
Aug 21, 2023

Conversation

shetzel
Copy link
Contributor

@shetzel shetzel commented Aug 15, 2023

What does this PR do?

Creates a new DecodeableMap class that extends the standard Map. A DecodableMap is the same as a Map except that the key must be a string, and whenever passing a key it will match on the exact text and the decoded text. Since ComponentSet.components Maps use component fullNames as keys, this allows encoded fullNames to match decoded fullNames, and vice versa.

What issues does this PR fix or reference?

@W-11658886@

@shetzel shetzel requested a review from a team as a code owner August 15, 2023 21:01
src/collections/componentSet.ts Outdated Show resolved Hide resolved
Comment on lines 110 to 114
for (const compKey of this.keys()) {
if (decodeURIComponent(compKey) === decodeURIComponent(key)) {
return compKey;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (const compKey of this.keys()) {
if (decodeURIComponent(compKey) === decodeURIComponent(key)) {
return compKey;
}
}
return this.keys().find((compKey) => decodeURIComponent(compKey) === decodeURIComponent(key))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.keys() returns an IterableIterator<string> so find() isn't available.

Copy link
Contributor

@mshanemc mshanemc Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.keys() returns an IterableIterator so find() isn't available.

you can call Array.from() on those to get a real array.

return Array.from(this.keys()).find((compKey) => decodeURIComponent(compKey) === decodeURIComponent(key))

@mshanemc
Copy link
Contributor

QA is here: forcedotcom/source-tracking#458

@mshanemc
Copy link
Contributor

Approved for release.

@shetzel shetzel merged commit 26aef11 into main Aug 21, 2023
64 of 65 checks passed
@shetzel shetzel deleted the sh/decoded-componentSet-keys branch August 21, 2023 16:11
shetzel added a commit that referenced this pull request Sep 5, 2023
shetzel added a commit that referenced this pull request Sep 5, 2023
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.

3 participants