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

Viewport meta tag not being deduplicated #8955

Closed
sdornan opened this issue Oct 3, 2019 · 2 comments · Fixed by #8960
Closed

Viewport meta tag not being deduplicated #8955

sdornan opened this issue Oct 3, 2019 · 2 comments · Fixed by #8960
Labels
good first issue Easy to fix issues, good for newcomers
Milestone

Comments

@sdornan
Copy link
Contributor

sdornan commented Oct 3, 2019

Bug report

Describe the bug

Default viewport tag is being appended to and not replaced whenever you use define your own custom viewport tag.

To Reproduce

Define a simple _app.tsx that attempts to set a custom viewport meta tag.

import App from 'next/app'
import Head from 'next/head'

class MyApp extends App {
  render() {
    const { Component, pageProps } = this.props

    return (
      <>
        <Head>
          <title>Some Title</title>
          <meta name="viewport" content="this-is-from-app.tsx" key="viewport" />
        </Head>
        <Component {...pageProps} />
      </>
    )
  }
}

export default MyApp

Expected behavior

I expected the default viewport tag to be deduplicated and replaced.

Screenshots

image

System information

  • OS: macOS
  • Browser (if applies): Chrome
  • Version of Next.js: 9.0.7

Additional context

After doing some searching, it looks to me like the initial tag is coming from https://github.com/zeit/next.js/blob/2ba352da39ee00b6595aecdc9ffb2f103e803a85/packages/next/next-server/lib/head.tsx#L11-L23 and is not properly being deduplicated. It doesn't seem to matter if you define the same key.

@timneutkens timneutkens added good first issue Easy to fix issues, good for newcomers help wanted labels Oct 3, 2019
@melanieseltzer
Copy link
Contributor

Would like to work on this! Will investigate and send a PR.

@Timer Timer added this to the 9.1.2 milestone Oct 18, 2019
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Easy to fix issues, good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants