Skip to content

Uncaught (in promise) TypeError: l.has is not a functionΒ #5170

@syc-thexigner

Description

@syc-thexigner

Description

When rendering a chart, an intermittent runtime error occurs:

Uncaught (in promise) TypeError: l.has is not a function

The error originates from apexcharts.js where textRectsCache (minified as l) is expected to be a Map instance.

Extensive runtime debugging confirms that textRectsCache is correctly initialized as new Map() and behaves as a valid Map during multiple render cycles. However, at some point during asynchronous rendering (Promise execution path), l.has is no longer recognized as a function, causing the application to crash.

This suggests that:

  • Either a different scoped variable (l) is being referenced
  • Or textRectsCache is being mutated/overwritten internally during async execution
  • Or there is a race condition during text measurement caching

This happens in a clean environment with only ApexCharts loaded once.


Steps to Reproduce

  1. Include apexcharts.js (>= 5.4.0, <= 5.3.6 is ok)
  2. Render a basic chart with axis labels enabled.
  3. Navigate to the page and allow the chart to render.
  4. During rendering (in Promise execution), the following error appears:
Uncaught (in promise) TypeError: l.has is not a function

Expected Behavior

textRectsCache should always remain a valid Map instance, and calls to .has() should not throw runtime errors.

Chart rendering should complete successfully without JavaScript exceptions.


Actual Behavior

The following error occurs:

Uncaught (in promise) TypeError: l.has is not a function

This indicates that at the moment of invocation, l is no longer a Map instance.

The error stack trace points to the internal text measurement cache logic.


Screenshots

Image Image
  • Debugging shows that l is a valid Map in earlier calls, but not at the moment of failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions