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.

@values doesn't support objects, causes error

See original GitHub issue

Current behavior

The @values tag works fine if you give it a space separated list of scalar values, like this:

@values sm, medium, large, inherit

However, if you try and use an object literal, it causes the styleguide to not render and display an error. These variations all fail:

@values
{
  type: 'String',
  thing: 'String',
  operation: 'String'
}

@values {
  type: 'String',
  thing: 'String',
  operation: 'String'
}

@values { type: 'String', thing: 'String', operation: 'String' }

These produces the following error instead of showing the styleguide:

TypeError: Reduce of empty array with no initial value
    in TableRenderer (created by Styled(Table))
    in Styled(Table) (created by PropsRenderer)
    in PropsRenderer (created by Styled(Props))
    in Styled(Props) (created by Usage)
    in div (created by Usage)
    in Usage (created by Slot)
    in div (created by Slot)
    in Slot (created by ReactComponent)
    in div (created by ReactComponentRenderer)
    in div (created by ReactComponentRenderer)
    in div (created by ReactComponentRenderer)
    in ReactComponentRenderer (created by Styled(ReactComponent))
    in Styled(ReactComponent) (created by ReactComponent)
    in ReactComponent (created by VsgReactComponent)
    in VsgReactComponent (created by Styled(VsgReactComponent))
    in Styled(VsgReactComponent) (created by Components)
    in div (created by ComponentsRenderer)
    in ComponentsRenderer (created by Components)
    in Components (created by Section)
    in section (created by SectionRenderer)
    in SectionRenderer (created by Styled(Section))
    in Styled(Section) (created by Section)
    in Section (created by Sections)
    in section (created by SectionsRenderer)
    in SectionsRenderer (created by Styled(Sections))
    in Styled(Sections) (created by Sections)
    in Sections (created by Section)
    in section (created by SectionRenderer)
    in SectionRenderer (created by Styled(Section))
    in Styled(Section) (created by Section)
    in Section (created by Sections)
    in section (created by SectionsRenderer)
    in SectionsRenderer (created by Styled(Sections))
    in Styled(Sections) (created by Sections)
    in Sections (created by StyleGuide)
    in main (created by StyleGuideRenderer)
    in div (created by StyleGuideRenderer)
    in StyleGuideRenderer (created by Styled(StyleGuide))
    in Styled(StyleGuide) (created by StyleGuide)
    in StyleGuide
This may be due to an error in a component you are overriding, or a bug in React Styleguidist.

If you believe this is a bug, please submit an issue.

Expected behaviour

I would be nice if this just worked, putting the object literal in the values column, or failing that, to produce a better error message - took me a while to track this one down. Alternatively, if this isn’t supported, the docs should say so. If that’the case, I’ll add this to #869 (I’m finally working on that now.)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
stephenjason89commented, Aug 18, 2021

Hello, it would really be nice as well if this will be supported as well. This helps the ide format the docblock instead of having the first /** and the last */

example

    /** Define the type, thing and operation that the component is associated with. If set, will be used to generate the title, heading & progress message. Object is expected to look like this:
     *  @example
     *  {
     *     type: 'asset',
     *     thing: 'file-utf8-876.txt',
     *     operation: 'delete'
     *  }
     */

Might be better if there’s an official way to document props /data that are object

I need to tell the user what values and properties the object can accept and how it will perform

Thank you

0reactions
dflockcommented, Jun 11, 2020

I’ll do my best, although it may take me a while to get to it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Object.values is not a function JavaScript
Now when I try to create an array from the values... var labels = Object.values(countries);. I get this error: Uncaught TypeError: Object ...
Read more >
Object Doesn't Support this Property or Method - Microsoft Learn
The "object doesn't support this property or method" error occurs when you try to use a method or property that the specified object...
Read more >
How to fix the 'Object doesn't support this property or method ...
FIrst - what the error message means - It means that the object doesn't have a property(field/attribute/variable) or method(function) by that name at...
Read more >
How to Fix TypeError: Null is Not an Object in JavaScript
The JavaScript error TypeError: null is not an object occurs when a property is accessed or a method is called on a null...
Read more >
Understanding the "Objects are not valid as a react child" Error ...
The motives for this error to be thrown are the diverse possible scenarios for rendering an object, and, allowing the developer to address...
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