bug(form-field): Uncaught exception when used inside custom element "TypeError: fn is not a function" [ver >= 20.0.0-rc.1] · Issue #61715 · angular/angular · GitHub
Skip to content

bug(form-field): Uncaught exception when used inside custom element "TypeError: fn is not a function" [ver >= 20.0.0-rc.1] #61715

Description

@atsjo

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

@angular/material 20.0.0-rc.0

Description

When form-field is used inside a custom element and afterRenderEffect is triggered (_syncOutlineLabelOffset() in https://github.com/angular/components/blob/main/src/material/form-field/form-field.ts), the below unhandled exception is thrown.

TypeError: fn is not a function
    at AfterRenderEffectSequence.destroy (core.mjs:4238:17)
    at debug_node-Nc-zr65s.mjs:16753:69
    at processCleanups (debug_node-Nc-zr65s.mjs:8113:13)
    at cleanUpView (debug_node-Nc-zr65s.mjs:8048:9)
    at destroyViewTree (debug_node-Nc-zr65s.mjs:7984:21)
    at destroyLView (debug_node-Nc-zr65s.mjs:8021:5)

The passing of signels from one phase to the next fails when running inside a custom element. This is a more generic problem than this bug report, but the only place this functionality is used in angular (core and material) as far as I could search on github is here.

It was introduced in this commit: angular/components#31086: perf(material/form-field): split DOM accesses into read and write

Reproduction

StackBlitz link:
Steps to reproduce:
1.
2.

Expected Behavior

It works as in 20.0.0-rc.0

Actual Behavior

An exception is thrown:

TypeError: fn is not a function
    at AfterRenderEffectSequence.destroy (core.mjs:4238:17)
    at debug_node-Nc-zr65s.mjs:16753:69
    at processCleanups (debug_node-Nc-zr65s.mjs:8113:13)
    at cleanUpView (debug_node-Nc-zr65s.mjs:8048:9)
    at destroyViewTree (debug_node-Nc-zr65s.mjs:7984:21)
    at destroyLView (debug_node-Nc-zr65s.mjs:8021:5)

Image

Environment

  • Angular: v20 rc-2
  • Angular CLI: v20 rc-3
  • CDK/Material: v20 rc-2
  • Browser(s): All
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions