question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: regression, angular devkit 12.2.1 causes form control to be created after Web Component mounted

See original GitHub issue

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which the bug was not present is @angular-devkit/build-angular@12.2.0.

Description

When using @angular-devkit/build-angular@12.2.1, form controls are created after a Web Component has been added to the DOM. This causes certain form components in Ionic Framework to not work properly.

πŸ”¬ Minimal Reproduction

  1. Clone repo: https://github.com/liamdebeasi/ng-form-init. This contains an Angular 12.2 project running @angular-devkit/build-angular@12.2.0 which is the last good version where the bug is not present.
  2. Run npm install and ng serve.
  3. Open app in browser.
  4. Click β€œShow Modal” button. Observe that the modal opens and there is a select dropdown with the label β€œTest Label” above a selected value of β€œb”.
  5. Close the modal and repeat step 4 again. The observation should be the same.
  6. Run npm install @angular-devkit/build-angular@12.2.1. This is the version that causes the bug to reproduce.
  7. Repeat steps 2-4. Observe that the modal opens correctly.
  8. Close and re-open the modal. Observe that this time, the label overlaps selected value β€œb”.
good ion-select bad ion-select
image image

πŸ”₯ Exception or Error

The problem here is that the ion-select component must have its value set on creation in order for the ion-label component to be positioned correctly. In Devkit 12.2.0 this works because the form control is created and the value is set before the ion-select component is added to the DOM (via connectedCallback). In Devkit 12.2.1 this does not work because the ion-select component is added to the DOM and then the form control is created.

🌍 Your Environment

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / β–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 12.2.3
Node: 15.9.0 (Unsupported)
Package Manager: npm 7.5.3
OS: darwin x64

Angular: 12.2.3
... cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.0
@angular-devkit/build-angular   12.2.0
@angular-devkit/core            12.2.3
@angular-devkit/schematics      12.2.3
@schematics/angular             12.2.3
rxjs                            6.6.7
typescript                      4.2.4
    

Anything else relevant?

Additional context: https://github.com/ionic-team/ionic-framework/issues/23809

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
alan-agius4commented, Sep 21, 2021

The defect that was exploited, is that Zone.js is unable intercept native async/await.

More context about this defect is captured in https://github.com/angular/angular/issues/31730.

0reactions
angular-automatic-lock-bot[bot]commented, Oct 31, 2021

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not find module "@angular-devkit/build ... - Stack Overflow
After updating to Angular 6.0.1, I get the following error on ng serve : Could not find module "@angular-devkit/build-angular" fromΒ ...
Read more >
The AI Search Engine You Control
You.com is an ad-free, private search engine that you control. Customize search results with 150 apps alongside web results. Access a zero-trace privateΒ ......
Read more >
Angular Forms Bug - StackBlitz
FormArray } from '@angular/forms'; Β· styleUrls: ['./app.component.css'] Β· error = false; Β· SignupForm: FormGroup; Β· constructor() {. } Β· } Β· 'email': new...
Read more >
Introduction to Cerberus - Cerberus documentation website
There are 2 Test Folder that have a specific behavior and allow to automatically add before and after any steps execution. Those 2...
Read more >
(PDF) Angular Development with Typescript Sec v6 MEAP
While Angular is a good fit for creating single-page apps, where the entire app is developed in this framework, the code written in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found