Esri / calcite-design-system

A monorepo containing the packages for Esri's Calcite Design System
https://developers.arcgis.com/calcite-design-system/
Other
260 stars 75 forks source link

`TypeError` in `filter` when disconnecting during update #9240

Open nwhittaker opened 2 weeks ago

nwhittaker commented 2 weeks ago

Check existing issues

Actual Behavior

If a <calcite-filter> element is in the middle of its update lifecycle when it's disconnected, it throws a TypeError.

Expected Behavior

If a <calcite-filter> element is in the middle of its update lifecycle when it's disconnected, it does not throw a TypeError.

Reproduction Sample

https://codepen.io/nwhittaker-esri/pen/LYvMQMm

Reproduction Steps

  1. Visit the code sample and open the dev tool's console
  2. See the TypeError logged in the console

Reproduction Version

2.7.1

Relevant Info

Looking at the stack trace, it appears as though the filter's update render is setting messageOverrides on its <calcite-input> element which in turn attempts to call the input's onMessagesChange watch method which is undefined at that point due to the input having been disconnected.

TypeError: f[t] is not a function
    at index.js:2464:38
    at Array.map (<anonymous>)
    at yt (index.js:2461:34)
    at f.set [as messageOverrides] (index.js:2557:25)
    at _ (index.js:926:29)
    at K (index.js:999:9)
    at nt (index.js:1577:17)
    at Z (index.js:1356:13)
    at nt (index.js:1583:13)
    at Z (index.js:1356:13)

This issue may not be limited to the filter component. It may impact any component that, in their render() methods, set messageOverrides on another component.

Regression?

No response

Priority impact

p3 - want for upcoming milestone

Impact

Adds verbosity to console logs and can be a red herring when debugging other issues. Can also impact how layouts are designed to mitigate the presence of this error.

Calcite package

Esri team

ArcGIS Field Apps

github-actions[bot] commented 13 hours ago

Installed and assigned for verification.