-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Uncaught (in promise) TypeError: l.has is not a functionΒ #5170
Description
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
textRectsCacheis 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
- Include
apexcharts.js(>= 5.4.0, <= 5.3.6 is ok) - Render a basic chart with axis labels enabled.
- Navigate to the page and allow the chart to render.
- 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
- Debugging shows that
lis a valid Map in earlier calls, but not at the moment of failure.