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

Title tag gets unset on client side #5635

Closed
nealoke opened this issue Nov 8, 2018 · 3 comments
Closed

Title tag gets unset on client side #5635

nealoke opened this issue Nov 8, 2018 · 3 comments

Comments

@nealoke
Copy link

nealoke commented Nov 8, 2018

Bug report

Describe the bug

When the title tag is created in a sub-component inside the Head tag it get's set to nothing after the client side bundle takes over. When disabling the JS in the devtools you can see that when the SSR code is used the title tag is used correctly.

To Reproduce

Use the code below, load up the index page and you will see the title change from My title is set here to an empty string when the client side bundle takes over.

// Pages/index.js
import React from 'react';
import Head from "next/head";
import MetaTags from "./../components/MetaTags";

export default () => (
    <Head>
        <MetaTags />
    </Head>
);
    
// components/MetaTags.js
import React, { Fragment } from 'react';

export default () => (
    <Fragment>
        <title>My title is set here</title>
    </Fragment>
);

Expected behavior

Expect the client side code to behave like the SSR code when nesting a title tag in the Head component.

Screenshots

Example of loading the page from a new tab
title tag

Screenshot of DOM tree (JS turned off via Chrome devtools)
image

Screenshot of DOM tree (JS turned on)
image

System information

  • Version of Next.js: 7.0.2

Additional information

When putting the title tag directly in the Head component it works as expected

@nealoke nealoke changed the title Title tag get's unset on client side Title tag gets unset on client side Nov 8, 2018
@timneutkens
Copy link
Member

I wonder why issues always turn up double within 24hours 😄 Sounds exactly the same as #5628

@nealoke
Copy link
Author

nealoke commented Nov 8, 2018

@timneutkens Yep it does 😄 . Should I close this or ?

@timneutkens
Copy link
Member

Duplicate of #5628

Yeah let's close it.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants