-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Conversation
CI Results: |
Build Results: |
@@ -49,6 +49,7 @@ export default class MfaLoginEnforcementForm extends Component { | |||
selected: [], | |||
}; | |||
@tracked authMethods = []; | |||
@tracked mfaMethods = []; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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. |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
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 propertymfa_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.