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

SSR also render async meta and content? #409

Open
francisrod01 opened this issue Oct 11, 2018 · 5 comments
Open

SSR also render async meta and content? #409

francisrod01 opened this issue Oct 11, 2018 · 5 comments
Labels

Comments

@francisrod01
Copy link

francisrod01 commented Oct 11, 2018

I'm trying to build an app where needs to get data before send props to <Helmet> but I don't know if it's possible because I don't see nothing like it in the docs.

And there's no possible to show this content in Helmet component. The content is always empty

The Helmet component is the HtmlPagecomponent. In the code below, we receive anSEO undefined` error.

Here the StackOverflow question too:

<HtmlPage
    {...this.props.client.info.SEO}
>

    <ThemeProvider theme={this.state.theme}>
        <div className='wrapper' id='wrapper'>

            {loading && <Loading 
                client={this.state.client}
            />}

            <div className="content" id='page-wrapper'>
                <h1>Its ok for now ====</h1>

                <p>
                    {JSON.stringify(this.props.client)}
                </p>

                <div>
                    {!!this.props.client.info &&
                        <p>{JSON.stringify(this.props.client.info.SEO)}</p>} 
                </div>
            </div>
        </div>
    </ThemeProvider>
</HtmlPage>
@tmbtech
Copy link
Contributor

tmbtech commented Oct 31, 2018

@francisrod01 Can you post the contents of ?

@francisrod01
Copy link
Author

francisrod01 commented Nov 2, 2018

@tmbtech I mentioned an example of application that load content using async data.
The Helmet doesn't load nothing in server-side rendering in this case.
So, I think we need to fix this with something.

Below I type the HtmlPage component using Helmet.

const theTitle = !!rest.title ? rest.title : defaultTitle;
const theDescription = !!rest.description ? rest.description : defaultDescription;
const theTags = (rest.keywords) ? rest.keywords : defaultTags;

console.log('--- HtmlPage after changes: ', theTitle, theDescription, theTags);

And on the console running as Server-Side:

GET /static/media/parallax1-min.2ab5a91c.jpg 200 3.687 ms - 397498
-- html headers props:  {}
--- HtmlPage after changes:     
-- html headers props:  {}
--- HtmlPage after changes:     
THE TITLE <title data-react-helmet="true"></title>
GET /logo.png 200 22.880 ms - -

There's the problem here! 👎
What do you think about it?

@francisrod01
Copy link
Author

francisrod01 commented Nov 13, 2018

@tmbtech Here's the codesanbox version:
https://codesandbox.io/s/0prlv0l2z0

You can also see it running on zeit/now:
https://csb-0prlv0l2z0-gazxsephel.now.sh/

@tmbtech
Copy link
Contributor

tmbtech commented Nov 25, 2018

Thank you for posting an example, I'll take a look this weekend. I have a feeling it related to the async rendering issues others are reporting.

@nimahkh
Copy link

nimahkh commented Dec 15, 2018

i have same problem here, in dynamic values, nothing will show in head

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

No branches or pull requests

3 participants