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

getStaticProps incompatible with hybrid AMP dynamic routes #17935

Closed
filipposarzana opened this issue Oct 16, 2020 · 5 comments
Closed

getStaticProps incompatible with hybrid AMP dynamic routes #17935

filipposarzana opened this issue Oct 16, 2020 · 5 comments

Comments

@filipposarzana
Copy link

filipposarzana commented Oct 16, 2020

Bug report

Describe the bug

getStaticProps receive different params when using AMP hybrid and dynamic routes.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:
1 - Create an hybrid AMP page with dynamic route (for example pages/[...fragments].js)
2 - add getStaticPaths and return data ({params: { fragments: ['foo', 'bar'] }})
2 - Run npm run dev
3 - add getStaticProps and console.log(params)
4 - you will get for one page fragments: ['foo', 'bar'] and then { amp: '1' }

Expected behavior

getStaticProps should receive all dynamic params and in addition amp

Code Sample

export const config = {
  amp: 'hybrid',
}

export const getStaticPaths = async () => {
  return {
    fallback: false,
    paths: [{
		params: {
			fragments: ['foo', 'bar']
		},
	}],
  }
}

export const getStaticProps = async ({ params }: Param) => {
  console.log(params)

  return {
    props: {
      fragments: params.fragments,
    },
  }
}

System information

  • Version of Next.js: 9.5.5

Additional context

Somewhat really similar to:

@timneutkens
Copy link
Member

Can you check next@canary, we merged a fix yesterday.

@filipposarzana
Copy link
Author

Confirm, it's working 🚀
You guys are amazing!

@timneutkens
Copy link
Member

timneutkens commented Oct 16, 2020

Will close this issue then as it's already on canary 👍 Thanks for confirming!

@filipposarzana
Copy link
Author

@timneutkens It's happening again since I updated to latest canary.
It prints { amp: 1 } only once 🤷

@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 29, 2022
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

3 participants