-
Notifications
You must be signed in to change notification settings - Fork 477
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
fix: inputs with extends TuiControl
has CD problems for writeValue
of empty value
#10220
base: main
Are you sure you want to change the base?
Conversation
Failed tests ❌Before (main) ← Diff → After (local)tests-core-textfield-textf-460ef-vity-on-hover-disable-state-chromium-retry2/textfield-disabled-hover.diff.pngtests-core-textfield-textf-6d0fb-vity-on-hover-invalid-state-chromium-retry2/textfield-invalid-hover.diff.pngtests-core-textfield-textf-df024-ity-on-hover-readonly-state-chromium-retry2/textfield-readonly-hover.diff.png(updated for commit 194d1e0) |
cy.get('tui-textfield').compareSnapshot({ | ||
name: 'input-number-write-value-empty-string', | ||
cypressScreenshotOptions: {padding: 8}, | ||
}); |
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.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10220 +/- ##
==========================================
- Coverage 65.78% 65.76% -0.02%
==========================================
Files 1240 1240
Lines 16223 16228 +5
Branches 2309 2310 +1
==========================================
+ Hits 10672 10673 +1
+ Misses 5404 5362 -42
- Partials 147 193 +46
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Visit the preview URL for this PR (updated for commit 194d1e0): https://taiga-previews-demo--pr10220-control-cd-bug-demo-lqztdzzi.web.app (expires Tue, 28 Jan 2025 06:41:06 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 73dddc3c665194f3e11f18c16aeb71af4c289c37 |
BundleMonFiles updated (1)
Unchanged files (4)
Total files change +49B +0.01% Groups updated (1)
Final result: ✅ View report in BundleMon website ➡️ |
f2089b5
to
89b0401
Compare
Playwright test results 7 failed Details Open report ↗︎ Failed testschromium › tests/core/data-list/data-list.pw.spec.ts › DataList › Custom list Skipped testswebkit › tests/addon-commerce/input-card-group.pw.spec.ts › InputCardGroup › Examples › input card grouped with validation |
protected valueChangeEffect = effect(() => { | ||
this.onChange(this.unmask(this.masked())); | ||
// Host binding `host: {'[value]': 'masked()'}` has change detection problem with empty string | ||
this.render.setProperty(this.el, 'value', this.masked()); |
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.
Since we only need it for value property we can make it a host directive to hide this hideous logic inside one place, if we cannot figure out why this issue is happening.
89b0401
to
194d1e0
Compare
@@ -24,6 +25,11 @@ export class TuiTextfieldBase<T> implements OnChanges { | |||
private readonly focused = signal<boolean | null>(null); | |||
|
|||
protected readonly control = inject(NgControl, {optional: true}); | |||
protected readonly tuiControl = inject(TuiControl, {optional: true}); | |||
protected readonly empty = computed( | |||
() => (this.tuiControl?.rawValue() ?? this.value()) === '', |
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.
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.
Yep, it is not reproducible for angular@17
extends TuiControl
has CD problems for writeValue
of empty valueextends TuiControl
has CD problems for writeValue
of empty value
extends TuiControl
has CD problems for writeValue
of empty valueextends TuiControl
has CD problems for writeValue
of empty value
Fixes #10202