You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In DoenetML, <number>s can be either floating point numbers or complex numbers represented by the object created by math.js. However, jsxgraph constructions expect floating point numbers for coordinates. Hence either the renderers or the component itself need to protect against the possibility of a coordinate being a complex number, for example by changing the complex number object into NaN.
This protection has been done in many places, but it is not universal, leading to Javascript crashes with errors such as "TypeError: Cannot convert object to primitive value". To increase the robustness of the code, we need to find cases where this error happens, add the protect, and add regression tests.
One example is in the point renderer where the state variable numericalXs can have complex numbers, and those values are passed directly into a setCoordinates command of a point (often using the intermediate variable lastPositionFromCore). We should either make the renderer more robust or change the numericalXs state variable to always convert to floating point numbers.
The text was updated successfully, but these errors were encountered:
Fixed the point numericalXs with #2362. However, we need a better test as the cypress test designed to test for regressions does not fail even if I remove the patch. (There is a Javascript error, but Doenet recovers and cypress doesn't catch that there was a Javascript error.)
We should also check to see if other components need the same protection as I did for point in #2362.
In DoenetML,
<number>
s can be either floating point numbers or complex numbers represented by the object created by math.js. However, jsxgraph constructions expect floating point numbers for coordinates. Hence either the renderers or the component itself need to protect against the possibility of a coordinate being a complex number, for example by changing the complex number object into NaN.This protection has been done in many places, but it is not universal, leading to Javascript crashes with errors such as "TypeError: Cannot convert object to primitive value". To increase the robustness of the code, we need to find cases where this error happens, add the protect, and add regression tests.
One example is in the point renderer where the state variable numericalXs can have complex numbers, and those values are passed directly into a setCoordinates command of a point (often using the intermediate variable lastPositionFromCore). We should either make the renderer more robust or change the numericalXs state variable to always convert to floating point numbers.
The text was updated successfully, but these errors were encountered: