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

Unable to conditionally render child components #20

Open
dan-fein opened this issue Jul 12, 2019 · 4 comments
Open

Unable to conditionally render child components #20

dan-fein opened this issue Jul 12, 2019 · 4 comments

Comments

@dan-fein
Copy link

Describe the bug
I understand this has been touched on in the past, but it's still occurring in .13.

When generating content and rendering it via {variableName}, the content does not render and yields: **
**

To Reproduce
Steps to reproduce the behavior:

<JSONLD>
              <Generic type="thing" jsonldtype="Thing" schema={{ url: link, image, description: overview, name }} />
              {products}
</JSONLD>

where products is an array generated like:

var products = []
for(var i = 0; i < itemCount; i++){
      let product = (<Product>
            <AggregateRating ratingCount={ratingCount} bestRating={bestRating} worstRating={worstRating} ratingValue={ratingValue} reviewCount={reviewCount}  />
      </Product>)
      products.push(product)
}

Expected behavior
This should render out all of the components.

Desktop (please complete the following information):

  • OS: MacOS
  • Browser Chrome
  • Version 75

Additional context
I did notice a few tickets from February saying this was handled, the bug has resurfaced.

@buzjuka
Copy link

buzjuka commented Jul 14, 2019

Hi
use separate for each product

Describe the bug
I understand this has been touched on in the past, but it's still occurring in .13.

When generating content and rendering it via {variableName}, the content does not render and yields: **
**

To Reproduce
Steps to reproduce the behavior:

<JSONLD>
              <Generic type="thing" jsonldtype="Thing" schema={{ url: link, image, description: overview, name }} />
              {products}
</JSONLD>

where products is an array generated like:

var products = []
for(var i = 0; i < itemCount; i++){
      let product = (<Product>
            <AggregateRating ratingCount={ratingCount} bestRating={bestRating} worstRating={worstRating} ratingValue={ratingValue} reviewCount={reviewCount}  />
      </Product>)
      products.push(product)
}

Expected behavior
This should render out all of the components.

Desktop (please complete the following information):

  • OS: MacOS
  • Browser Chrome
  • Version 75

Additional context
I did notice a few tickets from February saying this was handled, the bug has resurfaced.

@dan-fein
Copy link
Author

sorry i don't understand, what do you mean use separate? Use separate what?

@JaapWeijland
Copy link

I am having this issue as well:

TypeError: Cannot read property 'children' of undefined

<JSONLD>
    <Generic type="event" jsonldtype="Event" schema={{
                name,
                eventAttendanceMode: "https://schema.org/OfflineEventAttendanceMode",
                eventStatus: "https://schema.org/EventScheduled",
                description,
                startDate: moment(startDateMS).format("YYYY-MM-DD[T]HH:mm:ss"),
                endDate: moment(endDateMS).format("YYYY-MM-DD[T]HH:mm:ss")
            }}>
                {
                    items.map(({ name, price }) => {
                        return (
                            <Generic type="offers" jsonldtype="Offer" schema={{
                                name,
                                url: "https://shop.klappert.nl/s/" + slug,
                                price,
                                priceCurrency: "EUR",
                            }} />
                        )
                    })
                }
                <Generic type="location" jsonldtype="Place" schema={{ address: postalCode, name: location }} />
            </Generic>
        </JSONLD>

@Majrons
Copy link

Majrons commented May 8, 2020

I am having this issue as well:

TypeError: Cannot read property 'children' of undefined

<JSONLD>
    <Generic type="event" jsonldtype="Event" schema={{
                name,
                eventAttendanceMode: "https://schema.org/OfflineEventAttendanceMode",
                eventStatus: "https://schema.org/EventScheduled",
                description,
                startDate: moment(startDateMS).format("YYYY-MM-DD[T]HH:mm:ss"),
                endDate: moment(endDateMS).format("YYYY-MM-DD[T]HH:mm:ss")
            }}>
                {
                    items.map(({ name, price }) => {
                        return (
                            <Generic type="offers" jsonldtype="Offer" schema={{
                                name,
                                url: "https://shop.klappert.nl/s/" + slug,
                                price,
                                priceCurrency: "EUR",
                            }} />
                        )
                    })
                }
                <Generic type="location" jsonldtype="Place" schema={{ address: postalCode, name: location }} />
            </Generic>
        </JSONLD>

yes it is weird you have to wrap this condition in another generic collection

<GenericCollection>
{
                    items.map(({ name, price }) => {
                        return (
                            <Generic type="offers" jsonldtype="Offer" schema={{
                                name,
                                url: "https://shop.klappert.nl/s/" + slug,
                                price,
                                priceCurrency: "EUR",
                            }} />
                        )
                    })
                }
</GenericCollection>

and this is problem because in console i have warning:
Invalid prop 'jsonldtype' of type 'array' supplied to 'ChildNode', expected 'string'

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

4 participants