Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reduce of empty array with no initial value #99

Open
yoonieaj opened this issue Oct 25, 2024 · 2 comments
Open

Fix reduce of empty array with no initial value #99

yoonieaj opened this issue Oct 25, 2024 · 2 comments

Comments

@yoonieaj
Copy link
Collaborator

Running some examples in docs\docs\99-api\examples, (in particular, style_demo.js) results in TypeError: Reduce of empty array with no initial value.

@leowrites
Copy link
Collaborator

After some investigation, we found the issue to be the usage of 'x-large' font size. In getTextLength, the code assumes the font size to be in pixels, and parsing 'x-large' led to undefined behaviors.

Regardless, we should still add checks to ensure we never try to reduce with an empty array

@leowrites
Copy link
Collaborator

leowrites commented Nov 18, 2024

Updating on this, another issue that appeared: we pass configuration.width to drawAutomate. However, the width may be undefined. For some reason TS did not raise an error for this, but we should ensure there is a width set, which should fix the reduce empty array problem.

We should also add strict null checks to the tsconfig so bugs like this doesn't happen again in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants