Closed tomaszrondio closed 4 years ago
I moved my logic that was based on context to useAmp hook and it fixed the issue.
I moved my logic that was based on context to useAmp hook and it fixed the issue.
Can you please share a snippet of how you did that.
I was having logic in getStaticProps(context)
like that const _isAmp = context.params.amp ? true : false;
and simply moved it directly to page component. Here is my commit https://github.com/SuperdeskWebPublisher/publisher-pwa/commit/98862e635678178a66f481e80849388dd12a707f#diff-64730026d6dc32e1eedd945497d765a29d0939e3845877b9dd7a685059b026d0
Oh yeah, that's actually the recommended way to do it.
I believe that sooner or later there will be a case when someone will really need to know if isAmp
at the level of getStaticProps. But yeah so far so good :)
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.
Bug report
Describe the bug
When using a dynamic route in hybrid mode with getStaticProps and getStaticPaths, all static generated files have added
amp: 1
to context.E.g if getStaticPaths returns /article for [slug].js then these files are generated:
and in
article.json
context isSo first visit on article loads AMP component . Everything goes back to normal once revalidated.
To Reproduce
https://github.com/SuperdeskWebPublisher/publisher-pwa
context
(value of context.params is added to pageProps)Expected behavior
Article.json context should not contain
amp: 1
System information
Additional context
this may be connected: #17245