components icon indicating copy to clipboard operation
components copied to clipboard

bug(MatSlider): Slider breaks interactive development server

Open stefanomozart opened this issue 2 years ago • 4 comments

Is this a regression?

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

The previous version in which this bug was not present was

16

Description

When I use a mat-slider component in the template, any changes to the code should trigger a reload, but instead, the interactive server breaks with the following error:

TypeError: Cannot read properties of undefined (reading 'removeEventListener')
    at MatSliderVisualThumb.ngOnDestroy (slider.mjs:134:15)
    at executeOnDestroys (core.mjs:8388:32)
    at cleanUpView (core.mjs:8296:9)
    at destroyViewTree (core.mjs:8134:17)
    at destroyLView (core.mjs:8274:9)
    at ViewContainerRef.remove (core.mjs:20036:13)
    at ViewContainerRef.clear (core.mjs:19880:18)
    at NgIf._updateView (common.mjs:3373:37)
    at set ngIf (common.mjs:3350:14)
    at writeToDirectiveInput (core.mjs:13038:34)
    at setInputsForProperty (core.mjs:13277:9)
    at elementPropertyInternal (core.mjs:12562:9)
    at Module.ɵɵproperty (core.mjs:17475:9)
    at AppComponent_Template (app.component.html:50:11)
    at executeTemplate (core.mjs:12158:9)

Reproduction

StackBlitz link: Steps to reproduce: 1. 2.

Expected Behavior

The use a material component should not break the development server

Actual Behavior

The server stops reloading

Environment

  • Angular: 17.0.5
  • CDK/Material: 17.0.1
  • Browser(s):chrome 121.0.6167.139 (Official Build) (64-bit)
  • Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu 20.04

stefanomozart avatar Jan 31 '24 18:01 stefanomozart

I just added @angular/material to my v17 project. Testing it out with the slider. I'm getting similar but different, note: my application is all standalone, app and components. I updated everything else ng update suggested.

ERROR TypeError: Cannot read properties of undefined (reading '_hostElement')

dependencies (not showing dev deps) in package.json: "dependencies": { "@angular/animations": "^17.1.2", "@angular/cdk": "^17.1.2", "@angular/common": "^17.1.2", "@angular/compiler": "^17.1.2", "@angular/core": "^17.1.2", "@angular/forms": "^17.1.2", "@angular/material": "^17.1.2", "@angular/platform-browser": "^17.1.2", "@angular/platform-browser-dynamic": "^17.1.2", "@angular/router": "^17.1.2", "@ngxs/store": "^3.8.2", "git-rev": "^0.2.1", "rxjs": "~7.8.0", "tslib": "^2.3.0", "uuid": "^9.0.0", "zone.js": "~0.14.2" }

NOTE: other Material components working as expected

EDIT: next day...I went back to re-test and provide more code for example, the issue has disappeared for me, my example works today, please ignore this one (PIBKAC)

sdebeauchamp avatar Jan 31 '24 23:01 sdebeauchamp

The first error should've been fixed in 17.1.2 by https://github.com/angular/components/commit/9e02a1135bd108a3443e796f6c19385bce963495. The second one is new.

crisbeto avatar Feb 01 '24 07:02 crisbeto

Closing based on the edit in the last comment. It can be reopened if we get more info.

crisbeto avatar Feb 02 '24 07:02 crisbeto

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.