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
- 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
l is a valid Map in earlier calls, but not at the moment of failure.
Description
When rendering a chart, an intermittent runtime error occurs:
The error originates from
apexcharts.jswheretextRectsCache(minified asl) is expected to be aMapinstance.Extensive runtime debugging confirms that
textRectsCacheis correctly initialized asnew Map()and behaves as a validMapduring multiple render cycles. However, at some point during asynchronous rendering (Promise execution path),l.hasis no longer recognized as a function, causing the application to crash.This suggests that:
l) is being referencedtextRectsCacheis being mutated/overwritten internally during async executionThis happens in a clean environment with only ApexCharts loaded once.
Steps to Reproduce
apexcharts.js(>= 5.4.0, <= 5.3.6 is ok)Expected Behavior
textRectsCacheshould always remain a validMapinstance, and calls to.has()should not throw runtime errors.Chart rendering should complete successfully without JavaScript exceptions.
Actual Behavior
The following error occurs:
This indicates that at the moment of invocation,
lis no longer aMapinstance.The error stack trace points to the internal text measurement cache logic.
Screenshots
lis a valid Map in earlier calls, but not at the moment of failure.