perf(TextField): optimize secureWithoutAutofill#11131
Conversation
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx test apps-automated -c=ios |
❌ Failed | 2m 41s | View ↗ |
nx run-many --target=test --configuration=ci --... |
✅ Succeeded | 1s | View ↗ |
☁️ Nx Cloud last updated this comment at 2026-03-06 16:25:17 UTC
| nativeField.textContentType = typeof UITextContentTypeOneTimeCode !== 'undefined' ? UITextContentTypeOneTimeCode : ''; | ||
| if (textField.textContentType !== undefined) { | ||
| const desiredTextContentType = typeof UITextContentTypeOneTimeCode !== 'undefined' ? UITextContentTypeOneTimeCode : ''; | ||
| if (textField.textContentType !== desiredTextContentType) { |
There was a problem hiding this comment.
all those tests can be simplified:
typeof UITextContentTypeOneTimeCode !== 'undefined' ? UITextContentTypeOneTimeCode : '' to UITextContentTypeOneTimeCode ?? ''
And everytime both if can be done into one with something like if (textField.textContentType !== undefined && textField.textContentType !== desiredTextContentType)
All that making the code more readable
Also i dont understand the desiredTextContentType defaulting to ''. Shouldnt it default to undefined. which would also simplify the if test (no need to compare with undefined`
All that would make the code far less verbose and much easier to understand/maintain
There was a problem hiding this comment.
@NathanWalker I agree with @farfromrefug, this can be simplified a bit.
There was a problem hiding this comment.
@farfromrefug 💯 , pushed up simplification, much better. the textContentType empty string is not even needed. /cc @CatchABus

Uh oh!
There was an error while loading. Please reload this page.