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

Address Deprecation no-a-wth-array-like #28613

Merged
merged 4 commits into from
Oct 8, 2024

Conversation

Monkeychip
Copy link
Contributor

@Monkeychip Monkeychip commented Oct 7, 2024

Description

Address Ember data 5 deprecation No A with Array Like—see here.

Running the whole test suite with the flag on, it only showed up in the mfa create enforcements form.
In the template, we use map-to on the search select, passing in the model property mfa_methods. However, mfa-methods is a hasMany model property, which means when it's called directly it returns a PromiseManyProxy. I followed the established component pattern of fetching methods in the constructor of the component and setting to a tracked property, resolving this issue. Note: this was also an issue in another use of mfa_methods, resolved here.

  • Enterprise test pass

@Monkeychip Monkeychip added this to the 1.19.0-rc milestone Oct 7, 2024
@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Oct 7, 2024
Copy link

github-actions bot commented Oct 7, 2024

CI Results:
All Go tests succeeded! ✅

@Monkeychip Monkeychip marked this pull request as ready for review October 7, 2024 18:32
@Monkeychip Monkeychip requested a review from a team as a code owner October 7, 2024 18:32
Copy link

github-actions bot commented Oct 7, 2024

Build Results:
All builds succeeded! ✅

@@ -49,6 +49,7 @@ export default class MfaLoginEnforcementForm extends Component {
selected: [],
};
@tracked authMethods = [];
@tracked mfaMethods = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this update while the user manipulates the dom? If not, then it doesn't have to be tracked since it's just set once in the constructor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call! I'll amend.

Copy link
Contributor

@hellobontempo hellobontempo left a comment

Choose a reason for hiding this comment

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

Looks good! Just the comment about not needing @tracked for the variable. Same goes for authMethods actually!

@@ -59,6 +60,8 @@ export default class MfaLoginEnforcementForm extends Component {
this.resetTargetState();
// only auth method types that have mounts can be selected as targets -- fetch from sys/auth and map by type
this.fetchAuthMethods();
// this.args.model.mfa_methods returns a PromiseManyArray. We need to resolve this before using it in the template.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I feel like the comment below is sufficient and we don't need this here as well (it feels self-explanatory to me!) No need to remove, but just my thoughts 💭

@@ -94,6 +97,11 @@ export default class MfaLoginEnforcementForm extends Component {
this.authMethods = mounts.map((auth) => auth.type);
Copy link
Contributor

@hellobontempo hellobontempo Oct 8, 2024

Choose a reason for hiding this comment

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

Probably outside of scope - but when testing MFA last week i notice this doesn't filter out duplicates. if you wanted to throw a uniq() or filter on here
Screenshot 2024-10-08 at 9 35 49 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh good catch. i'll add that in.

@Monkeychip Monkeychip merged commit 9d4d563 into main Oct 8, 2024
31 checks passed
@Monkeychip Monkeychip deleted the ui/VAULT-3121/mfa-deprecations branch October 8, 2024 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed pr/no-changelog ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants