Skip to content

bug(mdc-migration): Migrate components selectively is bugged #26426

@llorenspujol

Description

@llorenspujol

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When Migrating to MDC-based Angular Material Components, and doing it component by component, it should only migrate the selected components. Right now other components that are not selected are also migrated. Seems that it only happens on imports.

Take for example this ngModule code:

      import {NgModule} from '@angular/core';
      import {MatLegacyButtonModule} from '@angular/material/legacy-button';
      import {MatLegacyCheckboxModule} from '@angular/material/legacy-checkbox';

      @NgModule({imports: [MatLegacyButtonModule, MatLegacyCheckboxModule]})
      export class AppModule {}

Right now, migrating this file selecting only the "button" migrates also the Checkbox. This should not happen.

Reproduction

Steps to reproduce:

Execute the migration for only "button" on this ngModule code:

      import {NgModule} from '@angular/core';
      import {MatLegacyButtonModule} from '@angular/material/legacy-button';
      import {MatLegacyCheckboxModule} from '@angular/material/legacy-checkbox';

      @NgModule({imports: [MatLegacyButtonModule, MatLegacyCheckboxModule]})
      export class AppModule {}

Expected Behavior

Should migrate only selected components

Actual Behavior

Selectively migrating components is buggy and in some cases, like imports, other components are also migrated

Environment

  • Angular: 15.1.0
  • CDK/Material: 15.1.0
  • Browser(s): -
  • Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions