question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Stack] Component throws error when direction prop is an array

See original GitHub issue

Describe the bug When an array is passed to the direction prop of Stack component, it throws TypeError direction.endsWith is not a function. See the image below:

Screenshot 2020-06-03 at 3 12 27 PM

This is because of this line in the Stack component. Also, TS doesn’t throw an error on VSCode. See the image below:

Screenshot 2020-06-03 at 3 13 44 PM

Expected Behavior TS should throw an error that only string is accepted. Also, no error should be shown on the browser because of this.

To Reproduce Add a Stack component and pass an array to the direction prop. Link to the issue in CodeSandbox.

Desktop (please complete the following information):

  • OS: macOS Catalina
  • Browser: Chrome
  • Version: 81.0.4044.138

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
with-heartcommented, Jun 13, 2020

@Ndifreke This has been fixed in 1.0. Hoping to have an alpha/beta released soon.

0reactions
openaruncommented, Jul 4, 2020

Got this error 😛 How do I fix it? I am on “@chakra-ui/core”: “^0.8.0”,

Read more comments on GitHub >

github_iconTop Results From Across the Web

Passing array to props but getting error while iterating [duplicate]
The error means that props is not an array like you think it is. I cannot offer any more help than that until...
Read more >
How to Read React Errors (fix 'Cannot read property of ...
This error usually means you're trying to use .map on an array, but that array isn't defined yet. That's often because the array...
Read more >
Stack API - Material UI - MUI
API reference docs for the React Stack component. Learn about the props, CSS, and other APIs of this exported module. ... Array<'column-reverse' |...
Read more >
Understanding the "Objects are not valid as a react child" Error ...
Inside the error, a clear rule states that JavaScript objects don't fit alongside the components, meaning that you should use the data from...
Read more >
Warning: Each Child in a List Should Have a Unique 'key' Prop
It is not recommended to use the index of the array as the key prop if you know the array will not be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found